{"id":13632669,"url":"https://github.com/smol-rs/async-io","last_synced_at":"2025-04-29T18:33:44.553Z","repository":{"id":37487340,"uuid":"275661195","full_name":"smol-rs/async-io","owner":"smol-rs","description":"Async I/O and timers","archived":false,"fork":false,"pushed_at":"2025-04-07T02:53:57.000Z","size":450,"stargazers_count":497,"open_issues_count":15,"forks_count":69,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-22T10:00:05.309Z","etag":null,"topics":["async","rust"],"latest_commit_sha":null,"homepage":"","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/smol-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-28T20:16:29.000Z","updated_at":"2025-04-11T01:00:59.000Z","dependencies_parsed_at":"2023-02-10T12:35:12.284Z","dependency_job_id":"3a619f2b-9c43-407b-b94d-b70ae2378fe0","html_url":"https://github.com/smol-rs/async-io","commit_stats":{"total_commits":267,"total_committers":33,"mean_commits":8.090909090909092,"dds":0.550561797752809,"last_synced_commit":"9d1ca6f8158ce39026c5029a8640dc6f92dee41e"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smol-rs%2Fasync-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smol-rs","download_url":"https://codeload.github.com/smol-rs/async-io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251560517,"owners_count":21609212,"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":["async","rust"],"created_at":"2024-08-01T22:03:10.425Z","updated_at":"2025-04-29T18:33:44.516Z","avatar_url":"https://github.com/smol-rs.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# async-io\n\n[![Build](https://github.com/smol-rs/async-io/actions/workflows/ci.yml/badge.svg)](\nhttps://github.com/smol-rs/async-io/actions)\n[![License](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue.svg)](\nhttps://github.com/smol-rs/async-io)\n[![Cargo](https://img.shields.io/crates/v/async-io.svg)](\nhttps://crates.io/crates/async-io)\n[![Documentation](https://docs.rs/async-io/badge.svg)](\nhttps://docs.rs/async-io)\n\nAsync I/O and timers.\n\nThis crate provides two tools:\n\n* `Async`, an adapter for standard networking types (and [many other] types) to use in\n  async programs.\n* `Timer`, a future that expires at a point in time.\n\nFor concrete async networking types built on top of this crate, see [`async-net`].\n\n[many other]: https://github.com/smol-rs/async-io/tree/master/examples\n[`async-net`]: https://docs.rs/async-net\n\n## Implementation\n\nThe first time `Async` or `Timer` is used, a thread named \"async-io\" will be spawned.\nThe purpose of this thread is to wait for I/O events reported by the operating system, and then\nwake appropriate futures blocked on I/O or timers when they can be resumed.\n\nTo wait for the next I/O event, the \"async-io\" thread uses [epoll] on Linux/Android/illumos,\n[kqueue] on macOS/iOS/BSD, [event ports] on illumos/Solaris, and [IOCP] on Windows. That\nfunctionality is provided by the [`polling`] crate.\n\nHowever, note that you can also process I/O events and wake futures on any thread using the\n`block_on()` function. The \"async-io\" thread is therefore just a fallback mechanism\nprocessing I/O events in case no other threads are.\n\n[epoll]: https://en.wikipedia.org/wiki/Epoll\n[kqueue]: https://en.wikipedia.org/wiki/Kqueue\n[event ports]: https://illumos.org/man/port_create\n[IOCP]: https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports\n[`polling`]: https://docs.rs/polling\n\n## Examples\n\nConnect to `example.com:80`, or time out after 10 seconds.\n\n```rust\nuse async_io::{Async, Timer};\nuse futures_lite::{future::FutureExt, io};\n\nuse std::net::{TcpStream, ToSocketAddrs};\nuse std::time::Duration;\n\nlet addr = \"example.com:80\".to_socket_addrs()?.next().unwrap();\n\nlet stream = Async::\u003cTcpStream\u003e::connect(addr).or(async {\n    Timer::after(Duration::from_secs(10)).await;\n    Err(io::ErrorKind::TimedOut.into())\n})\n.await?;\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n#### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmol-rs%2Fasync-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmol-rs%2Fasync-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmol-rs%2Fasync-io/lists"}