{"id":20208465,"url":"https://github.com/ivan770/enstream","last_synced_at":"2025-04-10T12:56:09.017Z","repository":{"id":38025892,"uuid":"501945153","full_name":"ivan770/enstream","owner":"ivan770","description":"Library to convert Future to Stream","archived":false,"fork":false,"pushed_at":"2022-06-11T13:30:45.000Z","size":40,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-10T22:51:50.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivan770.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-10T07:34:16.000Z","updated_at":"2024-08-24T03:29:23.000Z","dependencies_parsed_at":"2022-09-17T01:12:42.288Z","dependency_job_id":null,"html_url":"https://github.com/ivan770/enstream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fenstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fenstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fenstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivan770%2Fenstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivan770","download_url":"https://codeload.github.com/ivan770/enstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224573461,"owners_count":17333807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T05:35:45.155Z","updated_at":"2024-11-14T05:35:45.803Z","avatar_url":"https://github.com/ivan770.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enstream\n\nConvert `Future` to `Stream` in a simple and lightweight manner.\n\nCrate is fully compatible with `#![no_std]`.\n\n## Example usage\n\n```rust\n#![feature(type_alias_impl_trait)]\n\nuse std::future::Future;\n\nuse enstream::{HandlerFn, HandlerFnLifetime, Yielder, enstream};\nuse futures_util::{future::FutureExt, pin_mut, stream::StreamExt};\n\nstruct StreamState\u003c'a\u003e {\n    val: \u0026'a str\n}\n\n// A separate type alias is used to work around TAIT bugs\ntype Fut\u003c'yielder, 'a: 'yielder\u003e = impl Future\u003cOutput = ()\u003e;\n\nimpl\u003c'yielder, 'a\u003e HandlerFnLifetime\u003c'yielder, \u0026'a str\u003e for StreamState\u003c'a\u003e {\n    type Fut = Fut\u003c'yielder, 'a\u003e;\n}\n\nimpl\u003c'a\u003e HandlerFn\u003c\u0026'a str\u003e for StreamState\u003c'a\u003e {\n    fn call\u003c'yielder\u003e(\n        self,\n        mut yielder: Yielder\u003c'yielder, \u0026'a str\u003e,\n    ) -\u003e \u003cSelf as HandlerFnLifetime\u003c'yielder, \u0026'a str\u003e\u003e::Fut {\n        async move {\n            yielder.yield_item(self.val).await;\n        }\n    }\n}\n\nlet owned = String::from(\"test\");\n\nlet stream = enstream(StreamState {\n    val: \u0026owned\n});\n\npin_mut!(stream);\n\nassert_eq!(stream.next().now_or_never().flatten(), Some(\"test\"));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan770%2Fenstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivan770%2Fenstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivan770%2Fenstream/lists"}