{"id":39171484,"url":"https://github.com/lightsail-network/embedded-io-cursor","last_synced_at":"2026-01-17T22:23:21.545Z","repository":{"id":315333735,"uuid":"1059069171","full_name":"lightsail-network/embedded-io-cursor","owner":"lightsail-network","description":"A no_std-compatible Cursor implementation designed for use with embedded-io.","archived":false,"fork":false,"pushed_at":"2025-09-18T01:07:54.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-18T02:46:25.210Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightsail-network.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-18T00:37:53.000Z","updated_at":"2025-09-18T00:54:58.000Z","dependencies_parsed_at":"2025-09-18T02:56:31.824Z","dependency_job_id":null,"html_url":"https://github.com/lightsail-network/embedded-io-cursor","commit_stats":null,"previous_names":["lightsail-network/embedded-io-cursor"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lightsail-network/embedded-io-cursor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fembedded-io-cursor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fembedded-io-cursor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fembedded-io-cursor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fembedded-io-cursor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightsail-network","download_url":"https://codeload.github.com/lightsail-network/embedded-io-cursor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightsail-network%2Fembedded-io-cursor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28520225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-01-17T22:23:21.473Z","updated_at":"2026-01-17T22:23:21.534Z","avatar_url":"https://github.com/lightsail-network.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# embedded-io-cursor\n\n[![Crates.io](https://img.shields.io/crates/v/embedded-io-cursor)](https://crates.io/crates/embedded-io-cursor)\n[![docs.rs](https://docs.rs/embedded-io-cursor/badge.svg)](https://docs.rs/embedded-io-cursor)\n[![CI](https://github.com/lightsail-network/embedded-io-cursor/workflows/CI/badge.svg)](https://github.com/lightsail-network/embedded-io-cursor/actions)\n\nA `no_std`-compatible Cursor implementation designed for use with `embedded-io`.\n\nThis crate provides a `Cursor` type that wraps an in-memory buffer and provides `Read`, `Write`, `Seek`, and `BufRead` implementations using the `embedded-io` traits. Unlike the standard library's `Cursor`, this implementation works in `no_std` environments while maintaining API compatibility where possible.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nembedded-io-cursor = \"0.1.0\"\n```\n\n### Basic Usage\n\n```rust\nuse embedded_io::{Read, Write, Seek, SeekFrom};\nuse embedded_io_cursor::Cursor;\n\n// Reading from a static buffer\nlet mut cursor = Cursor::new(\u0026b\"hello world\"[..]);\nlet mut buf = [0u8; 5];\ncursor.read_exact(\u0026mut buf).unwrap();\nassert_eq!(\u0026buf, b\"hello\");\n\n// Writing to a mutable buffer\nlet mut buffer = [0u8; 10];\n{\n    use embedded_io::Write;\n    let mut cursor = Cursor::new(\u0026mut buffer[..]);\n    let data = b\"test\";\n    let mut written = 0;\n    while written \u003c data.len() {\n        written += cursor.write(\u0026data[written..]).unwrap();\n    }\n}\nassert_eq!(\u0026buffer[..4], b\"test\");\n```\n\n### With `alloc` feature (requires `alloc` feature to be enabled)\n\n```rust\n# #[cfg(feature = \"alloc\")] {\nuse embedded_io::Write;\nuse embedded_io_cursor::Cursor;\nextern crate alloc;\nuse alloc::vec::Vec;\n\nlet mut vec = Vec::new();\nlet mut cursor = Cursor::new(\u0026mut vec);\nlet data = b\"hello world\";\nlet mut written = 0;\nwhile written \u003c data.len() {\n    written += cursor.write(\u0026data[written..]).unwrap();\n}\nassert_eq!(vec, b\"hello world\");\n# }\n```\n\n## Features\n\n- `default`: No additional features enabled\n- `std`: Enable standard library support (implies `alloc`)\n- `alloc`: Enable support for `Vec\u003cu8\u003e` and `Box\u003c[u8]\u003e`\n- `defmt`: Enable `defmt` formatting support\n\n## Differences from `std::io::Cursor`\n\nThis implementation maintains API compatibility with `std::io::Cursor` where possible, but has some key differences:\n\n1. **Uses `embedded-io` traits**: Instead of `std::io` traits, this uses the `embedded-io` equivalents\n2. **Full `BufRead` support**: Implements `embedded-io::BufRead` with `fill_buf()` and `consume()`\n3. **Limited buffer types in `no_std`**: Without `alloc`, only basic slice types are supported\n4. **Error type**: Uses `embedded_io::ErrorKind` instead of `std::io::Error`\n\n## Testing\n\nRun tests with:\n\n```bash\ncargo test                           # All tests (includes doctests)\ncargo test --no-default-features     # no_std tests only\ncargo test --features alloc          # With alloc support\ncargo test --features std            # With std support\ncargo test --lib --tests             # Unit and integration tests only\n```\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsail-network%2Fembedded-io-cursor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightsail-network%2Fembedded-io-cursor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightsail-network%2Fembedded-io-cursor/lists"}