| Crates.io | embedded-io-extras |
| lib.rs | embedded-io-extras |
| version | 0.0.2 |
| created_at | 2024-09-12 06:42:43.45825+00 |
| updated_at | 2024-09-18 11:45:13.303973+00 |
| description | Additional utilities for embedded-io, including a Cursor type for no_std environments. |
| homepage | https://github.com/lightsail-network/embedded-io-extras |
| repository | https://github.com/lightsail-network/embedded-io-extras |
| max_upload_size | |
| id | 1372520 |
| size | 23,643 |
embedded-io-extras is a no_std compatible library providing additional utilities,
including a Cursor type. It functions like std::io::Cursor but is tailored for environments without
standard libraries. This crate complements embedded-io.
Add this to your Cargo.toml:
[dependencies]
embedded-io-extras = "0.0.2"
and for no_std environments:
[dependencies]
embedded-io-extras = { version = "0.0.2", default-features = false, features = ["alloc"] }
std: Enable this feature to use std with embedded-io. Enabled by default.alloc: Enable this feature to support dynamic memory allocation with embedded-io. Enabled by default.use embedded_io_extras::{Cursor, Write};
fn main() {
let mut cur = Cursor::new(Vec::new());
assert_eq!(cur.write(&[1, 2, 3]).unwrap(), 3);
assert_eq!(cur.position(), 3);
assert_eq!(cur.get_ref(), &vec![1, 2, 3]);
}
This project is licensed under the MIT License.