{"id":20975853,"url":"https://github.com/banyc/async_async_io","last_synced_at":"2026-01-25T14:04:36.891Z","repository":{"id":174951458,"uuid":"653080503","full_name":"Banyc/async_async_io","owner":"Banyc","description":"`AsyncRead`, `AsyncWrite` traits but with `async fn` methods.","archived":false,"fork":false,"pushed_at":"2024-11-01T12:41:11.000Z","size":27,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T13:35:28.164Z","etag":null,"topics":["io","tokio"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/async_async_io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Banyc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-06-13T11:19:10.000Z","updated_at":"2025-06-28T01:44:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"6a74882c-5a2d-43bf-a5aa-b60e391ee09e","html_url":"https://github.com/Banyc/async_async_io","commit_stats":null,"previous_names":["banyc/async_async_io"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Banyc/async_async_io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyc%2Fasync_async_io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyc%2Fasync_async_io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyc%2Fasync_async_io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyc%2Fasync_async_io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Banyc","download_url":"https://codeload.github.com/Banyc/async_async_io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banyc%2Fasync_async_io/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["io","tokio"],"created_at":"2024-11-19T04:47:49.355Z","updated_at":"2026-01-25T14:04:36.856Z","avatar_url":"https://github.com/Banyc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `async_async_io`\n\nCurrently, only for `tokio`.\n\n## `impl_trait_in_assoc_type` (Optional)\n\n- use nightly channel;\n- enable the feature `\"impl_trait_in_assoc_type\"`;\n- look into the tests in `src/read.rs` and `src/write.rs` to see how to implement the traits.\n\n## Usage\n\n### `AsyncAsyncRead`\n\nDefinition:\n\n```rust\npub struct AsyncReadBytes {\n    reader: std::io::Cursor\u003cVec\u003cu8\u003e\u003e,\n}\n\nimpl async_async_io::read::AsyncAsyncRead for AsyncReadBytes {\n    async fn read(\u0026mut self, buf: \u0026mut [u8]) -\u003e std::io::Result\u003cusize\u003e {\n        let len = std::io::Read::read(\u0026mut self.reader, buf)?;\n        print!(\"{}.\", len);\n        Ok(len)\n    }\n}\n```\n\nConversion to `AsyncRead`:\n\n```rust\nlet stream = AsyncReadBytes::new(b\"hello world\".to_vec());\nlet mut async_read = async_async_io::read::PollRead::new(stream);\n\nlet mut writer = [0; 5];\nasync_read.read_exact(\u0026mut writer).await.unwrap();\nassert_eq!(\u0026writer, b\"hello\");\n```\n\n### `AsyncAsyncWrite`\n\nDefinition:\n\n```rust\npub struct AsyncWriteBytes {\n    writer: Vec\u003cu8\u003e,\n}\n\nimpl async_async_io::write::AsyncAsyncWrite for AsyncWriteBytes {\n    async fn write(\u0026mut self, buf: \u0026[u8]) -\u003e std::io::Result\u003cusize\u003e {\n        print!(\"{}.\", buf.len());\n        std::io::Write::write(\u0026mut self.writer, buf)\n    }\n\n    async fn flush(\u0026mut self) -\u003e std::io::Result\u003c()\u003e {\n        std::io::Write::flush(\u0026mut self.writer)\n    }\n\n    async fn shutdown(\u0026mut self) -\u003e std::io::Result\u003c()\u003e {\n        Ok(())\n    }\n}\n```\n\nConversion to `AsyncWrite`:\n\n```rust\nlet writer = AsyncWriteBytes::new();\nlet mut async_write = async_async_io::write::PollWrite::new(writer);\n\nasync_write.write_all(b\"hello world\").await.unwrap();\nassert_eq!(async_write.into_inner().written(), b\"hello world\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanyc%2Fasync_async_io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanyc%2Fasync_async_io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanyc%2Fasync_async_io/lists"}