2 releases
0.0.2 | Sep 18, 2024 |
---|---|
0.0.1 | Sep 12, 2024 |
#338 in Embedded development
59 downloads per month
22KB
439 lines
embedded-io-extras
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
.
Usage
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 usestd
withembedded-io
. Enabled by default.alloc
: Enable this feature to support dynamic memory allocation withembedded-io
. Enabled by default.
Examples
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]);
}
License
This project is licensed under the MIT License.
Dependencies
~175KB