[][src]Struct rpos_drv::RingByteBuffer

pub struct RingByteBuffer { /* fields omitted */ }

A ring byte buffer used to operate byte streams

Example

let mut buffer = rpos_drv::RingByteBuffer::with_capacity(100);
buffer.write(&[0, 1, 2, 3]).unwrap();
assert_eq!(buffer.len(), 4 as usize);

Methods

impl RingByteBuffer
[src]

Important traits for RingByteBuffer

create a ring buffer with capacity

the data in the ring buffer

the capacity of the ring buffer

free space in bytes in the ring buffer

current read slice

Example

let read_slice = buffer.current_read_slice();
let read = some_stream.write(read_slice).unwrap();
buffer.skip_bytes(read);

skip bytes

read data from upstream to fill the ring buffer

Example

let read = buffer.read_from(&mut some_stream).unwrap();
println!("{} bytes read from stream to fill buffer, current length of buffer is: {}", read, buffer.len());

Trait Implementations

impl PartialEq<RingByteBuffer> for RingByteBuffer
[src]

impl Clone for RingByteBuffer
[src]

Performs copy-assignment from source. Read more

impl Debug for RingByteBuffer
[src]

impl Read for RingByteBuffer
[src]

🔬 This is a nightly-only experimental API. (read_initializer)

Determines if this Reader can work with buffers of uninitialized memory. Read more

Read all bytes until EOF in this source, placing them into buf. Read more

Read all bytes until EOF in this source, appending them to buf. Read more

Read the exact number of bytes required to fill buf. Read more

Creates a "by reference" adaptor for this instance of Read. Read more

Transforms this Read instance to an [Iterator] over its bytes. Read more

Creates an adaptor which will chain this stream with another. Read more

Creates an adaptor which will read at most limit bytes from it. Read more

impl Write for RingByteBuffer
[src]

Attempts to write an entire buffer into this write. Read more

Writes a formatted string into this writer, returning any error encountered. Read more

Creates a "by reference" adaptor for this instance of Write. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.