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

#1730 in Rust patterns

Download history 57/week @ 2024-03-12 34/week @ 2024-03-19 31/week @ 2024-03-26 72/week @ 2024-04-02 45/week @ 2024-04-09 29/week @ 2024-04-16 85/week @ 2024-04-23 41/week @ 2024-04-30 42/week @ 2024-05-07 68/week @ 2024-05-14 74/week @ 2024-05-21 80/week @ 2024-05-28 69/week @ 2024-06-04 91/week @ 2024-06-11 76/week @ 2024-06-18 86/week @ 2024-06-25

336 downloads per month
Used in 17 crates (13 directly)

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