{"id":17866498,"url":"https://github.com/LightQuantumArchive/tokio-io-compat","last_synced_at":"2025-03-21T07:31:47.042Z","repository":{"id":38312796,"uuid":"417894300","full_name":"LightQuantumArchive/tokio-io-compat","owner":"LightQuantumArchive","description":"Compatibility wrapper around std io traits that implements tokio io traits.","archived":false,"fork":false,"pushed_at":"2025-03-13T09:58:41.000Z","size":57,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:22:02.779Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LightQuantumArchive.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-16T17:09:01.000Z","updated_at":"2025-01-13T23:02:15.000Z","dependencies_parsed_at":"2024-07-29T12:16:25.721Z","dependency_job_id":"278879b3-7920-4627-90a8-84571501bef2","html_url":"https://github.com/LightQuantumArchive/tokio-io-compat","commit_stats":{"total_commits":28,"total_committers":2,"mean_commits":14.0,"dds":0.1071428571428571,"last_synced_commit":"0e4c86ce366f611ca8390b2108a7125a5a372b40"},"previous_names":["lightquantumarchive/tokio-io-compat","photonquantum/tokio-io-compat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Ftokio-io-compat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Ftokio-io-compat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Ftokio-io-compat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LightQuantumArchive%2Ftokio-io-compat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LightQuantumArchive","download_url":"https://codeload.github.com/LightQuantumArchive/tokio-io-compat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244758055,"owners_count":20505569,"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-10-28T09:37:18.193Z","updated_at":"2025-03-21T07:31:46.742Z","avatar_url":"https://github.com/LightQuantumArchive.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tokio-io-compat\n\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/PhotonQuantum/tokio-io-compat/Test?style=flat-square)](https://github.com/PhotonQuantum/tokio-io-compat/actions/workflows/test.yml)\n[![crates.io](https://img.shields.io/crates/v/tokio-io-compat?style=flat-square)](https://crates.io/crates/tokio-io-compat)\n[![Documentation](https://img.shields.io/docsrs/tokio-io-compat?style=flat-square)](https://docs.rs/tokio-io-compat)\n\nCompatibility wrapper around `std::io::{Read, Write, Seek}` traits that\nimplements `tokio::io::{AsyncRead, AsyncWrite, AsyncSeek}`.\n\nBeware that this won't magically make your IO operations asynchronous.\nYou should still consider asyncify your code or move the IO operations to blocking thread if the cost is high.\n\n\n## Deal with `WouldBlock`\n\nIf you are trying to wrap a non-blocking IO, it may yield `WouldBlock` errors when data\nis not ready.\nThis wrapper will automatically convert `WouldBlock` into `Poll::Pending`.\n\nHowever, the waker must be waken later to avoid blocking the future.\nBy default, it is waken immediately. This may waste excessive CPU cycles, especially when the operation\nis slow.\n\nYou may add a delay before each wake by creating the wrapper with `AsyncIoCompat::new_with_delay`.\nIf your underlying non-blocking IO has a native poll complete notification mechanism, consider\nwriting your own wrapper instead of using this crate.\n\nFor reference please see [tokio-tls](https://github.com/tokio-rs/tls/blob/master/tokio-native-tls/src/lib.rs).\n\n## Example\n\n```rust\nuse std::io::Cursor;\nuse tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};\nuse tokio_io_compat::CompatHelperTrait;\n\nlet mut data = Cursor::new(vec![]);\ndata.tokio_io_mut().write_all(\u0026vec![0, 1, 2, 3, 4]).await.unwrap();\ndata.tokio_io_mut().seek(SeekFrom::Start(2)).await.unwrap();\nassert_eq!(data.tokio_io_mut().read_u8().await.unwrap(), 2);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLightQuantumArchive%2Ftokio-io-compat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLightQuantumArchive%2Ftokio-io-compat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLightQuantumArchive%2Ftokio-io-compat/lists"}