{"id":30537386,"url":"https://github.com/berrysoft/stream-future","last_synced_at":"2025-08-27T18:40:02.342Z","repository":{"id":57907810,"uuid":"529067127","full_name":"Berrysoft/stream-future","owner":"Berrysoft","description":"Implement Future + Stream with generators.","archived":false,"fork":false,"pushed_at":"2024-05-21T05:15:33.000Z","size":30,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-17T02:54:08.513Z","etag":null,"topics":["asynchronous","futures","generators","iterators","rust","stream"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Berrysoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-08-26T00:58:47.000Z","updated_at":"2024-05-21T05:15:37.000Z","dependencies_parsed_at":"2023-01-30T20:00:21.790Z","dependency_job_id":"12d7c1bf-e003-4f8a-8dee-75443f588b60","html_url":"https://github.com/Berrysoft/stream-future","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"4f1c05276922b65795bba8ef982ae7dbc9aa951c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Berrysoft/stream-future","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fstream-future","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fstream-future/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fstream-future/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fstream-future/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Berrysoft","download_url":"https://codeload.github.com/Berrysoft/stream-future/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Berrysoft%2Fstream-future/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272362884,"owners_count":24921402,"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","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asynchronous","futures","generators","iterators","rust","stream"],"created_at":"2025-08-27T18:39:56.896Z","updated_at":"2025-08-27T18:40:02.332Z","avatar_url":"https://github.com/Berrysoft.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stream-future\n\n[![crates.io](https://img.shields.io/crates/v/stream-future)](https://crates.io/crates/stream-future)\n[![docs.rs](https://img.shields.io/badge/docs.rs-stream--future-latest)](https://docs.rs/stream-future)\n\nThis is a `no_std` compatible library to author a `Future` with `Stream` implemented.\nYou can author simply with `await` and `yield`.\n\nA nightly feature `coroutines` is required.\n\n``` rust\n#![feature(coroutines)]\n\nuse stream_future::stream;\n\n#[derive(Debug)]\nenum Prog {\n    Stage1,\n    Stage2,\n}\n\n#[stream(Prog)]\nasync fn foo() -\u003e Result\u003ci32\u003e {\n    yield Prog::Stage1;\n    // some works...\n    yield Prog::Stage2;\n    // some other works...\n    Ok(0)\n}\n\nuse tokio_stream::StreamExt;\n\nlet bar = foo();\ntokio::pin!(bar);\nwhile let Some(prog) = bar.next().await {\n    println!(\"{:?}\", prog);\n}\nlet bar = bar.await?;\nassert_eq!(bar, 0);\n```\n\n``` rust\n#![feature(coroutines)]\n\nuse stream_future::try_stream;\n\n#[derive(Debug)]\nenum Prog {\n    Stage1,\n    Stage2,\n}\n\n#[try_stream(Prog)]\nasync fn foo() -\u003e Result\u003c()\u003e {\n    yield Prog::Stage1;\n    // some works...\n    yield Prog::Stage2;\n    // some other works...\n    Ok(())\n}\n\nlet bar = foo();\ntokio::pin!(bar);\nwhile let Some(prog) = bar.try_next().await? {\n    println!(\"{:?}\", prog);\n}\n```\n\nYou can specify the yield type in the attribute. Either the yield type or return type could be `()`.\nYou can simply `await` other futures, and the macro will handle that.\n\n## Compare with `async-stream`\nYou can return any value you like! The caller can simply `await` and get the value without iterate the stream.\n\nThis library is 7x faster than `async-stream`, according to our benchmark.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrysoft%2Fstream-future","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberrysoft%2Fstream-future","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrysoft%2Fstream-future/lists"}