buffered-io

Crates.iobuffered-io
lib.rsbuffered-io
version0.5.4
sourcesrc
created_at2023-03-02 07:05:00.020319
updated_at2024-06-28 08:32:22.813616
descriptionBufferering types for embedded-io
homepage
repositoryhttps://github.com/rmja/buffered-io
max_upload_size
id798687
size17,671
Rasmus Melchior Jacobsen (rmja)

documentation

README

Buffer Types for embedded-io

CI crates.io docs.rs

The buffered-io crate implements buffering for the embedded-io/embedded-io-async Read and Write traits.

Example

tokio_test::block_on(async {
    use buffered_io::asynch::BufferedWrite;
    use embedded_io_async::Write;
    
    let uart_tx = Vec::new(); // The underlying uart peripheral implementing Write to where buffered bytes are written
    let mut write_buf = [0; 120];
    let mut buffering = BufferedWrite::new(uart_tx, &mut write_buf);
    buffering.write(b"hello").await.unwrap(); // This write is buffered
    buffering.write(b" ").await.unwrap(); // This write is also buffered
    buffering.write(b"world").await.unwrap(); // This write is also buffered
    buffering.flush().await.unwrap(); // The string "hello world" is written to uart in one write
})
Commit count: 56

cargo fmt