10 releases

Uses old Rust 2015

0.1.9 Mar 6, 2021
0.1.8 Jul 12, 2017
0.1.7 Mar 26, 2017
0.1.6 Jul 21, 2016
0.1.4 Mar 20, 2016

#2554 in Rust patterns

Download history 32/week @ 2023-11-27 61/week @ 2023-12-04 96/week @ 2023-12-11 48/week @ 2023-12-18 60/week @ 2023-12-25 74/week @ 2024-01-01 85/week @ 2024-01-08 165/week @ 2024-01-15 97/week @ 2024-01-22 60/week @ 2024-01-29 109/week @ 2024-02-05 127/week @ 2024-02-12 137/week @ 2024-02-19 102/week @ 2024-02-26 76/week @ 2024-03-04 56/week @ 2024-03-11

376 downloads per month
Used in 3 crates

MIT/Apache

20KB
418 lines

buffer

buffer provides safe, write-only and generics-free byte buffers that can be used without initializing them first.

Example

let mut vec = Vec::with_capacity(1024);
if try!(reader.read_buffer(&mut vec)).len() != 0 {
    if vec[0] == 0 {
        // ...
    }
}

lib.rs:

buffer provides safe, write-only and generics-free byte buffers that can be used without initializing them first.

The main trait of this library is Buffer that represents a type that can contain uninitialized bytes (such as Vec, ArrayVec, etc.) and can safely be read into (e.g. using ReadBuffer).

In order to keep code sizes down, such a type implementing Buffer is quickly converted into the struct BufferRef, so this is the type receivers of types implementing Buffers should work with.

An example for the usage of this trait can be found with ReadBuffer which implements reading into a buffer without initializing it first.

Dependencies

~82KB