{"id":13438533,"url":"https://github.com/rustcc/coroutine-rs","last_synced_at":"2025-05-16T11:03:45.789Z","repository":{"id":27819474,"uuid":"31309088","full_name":"rustcc/coroutine-rs","owner":"rustcc","description":"Coroutine Library in Rust","archived":false,"fork":false,"pushed_at":"2022-07-01T02:23:36.000Z","size":258,"stargazers_count":414,"open_issues_count":5,"forks_count":42,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-10T19:37:05.067Z","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/rustcc.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":"2015-02-25T10:46:55.000Z","updated_at":"2025-05-02T00:29:25.000Z","dependencies_parsed_at":"2022-07-25T17:32:57.053Z","dependency_job_id":null,"html_url":"https://github.com/rustcc/coroutine-rs","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/rustcc%2Fcoroutine-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Fcoroutine-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Fcoroutine-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustcc%2Fcoroutine-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustcc","download_url":"https://codeload.github.com/rustcc/coroutine-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"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-07-31T03:01:06.278Z","updated_at":"2025-05-16T11:03:45.744Z","avatar_url":"https://github.com/rustcc.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["Concurrency","并发性 Concurrency","并发 Concurrency","并发"],"readme":"# coroutine-rs\n\n[![Build Status](https://img.shields.io/travis/rustcc/coroutine-rs.svg)](https://travis-ci.org/rustcc/coroutine-rs) [![crates.io](https://img.shields.io/crates/v/coroutine.svg)](https://crates.io/crates/coroutine) [![crates.io](https://img.shields.io/crates/l/coroutine.svg)](https://crates.io/crates/coroutine)\n\n[Coroutine](https://en.wikipedia.org/wiki/Coroutine) library in Rust\n\n```toml\n[dependencies]\ncoroutine = \"0.8\"\n```\n\n## Usage\n\nBasic usage of Coroutine\n\n```rust\nextern crate coroutine;\n\nuse std::usize;\nuse coroutine::asymmetric::Coroutine;\n\nfn main() {\n    let coro: Coroutine\u003ci32\u003e = Coroutine::spawn(|me,_| {\n        for num in 0..10 {\n            me.yield_with(num);\n        }\n        usize::MAX\n    });\n\n    for num in coro {\n        println!(\"{}\", num.unwrap());\n    }\n}\n```\n\nThis program will print the following to the console\n\n```\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n18446744073709551615\n```\n\nFor more detail, please run `cargo doc --open`.\n\n## Goals\n\n- [x] Basic single threaded coroutine support\n\n- [x] Asymmetric Coroutines\n\n- [ ] Symmetric Coroutines\n\n- [ ] Thread-safe: can only resume a coroutine in one thread simultaneously\n\n## Notes\n\n* Basically it supports arm, i686, mips, mipsel and x86_64 platforms, but we have only tested in\n\n    - OS X 10.10.*, x86_64, nightly\n\n    - ArchLinux, x86_64, nightly\n\n## Thanks\n\n- The Rust developers (context switch ASM from libgreen)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcc%2Fcoroutine-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustcc%2Fcoroutine-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustcc%2Fcoroutine-rs/lists"}