pub struct Consumer<T> { /* fields omitted */ }
Consumer part of ring buffer.
Returns capacity of the ring buffer.
Checks if the ring buffer is empty.
Checks if the ring buffer is full.
Retrieves element from ring buffer.
On success returns element been retrieved.
Retrieves elements from ring buffer into slice. Elements should be cloneable.
On success returns count of elements been retrieved from ring buffer.
pub unsafe fn pop_access<R, E, F>( &mut self, f: F ) -> Result<Result<(usize, R), E>, PopAccessError> where R: Sized, E: Sized, F: FnOnce(&mut [T], &mut [T]) -> Result<(usize, R), E>, | [src] |
Allows to read from ring buffer memory directry.
This function is unsafe beacuse it gives access to possibly uninitialized memory
and transfers responsibility of manually calling destructors
Takes a function f
as argument.
f
takes two slices of ring buffer content (the second one may be empty). First slice contains older elements.
f
should return:
- On success: pair of number of elements been read, and some arbitrary data.
- On failure: some another arbitrary data.
On success returns data returned from f
.
Write into Write
instance.
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
🔬 This is a nightly-only experimental API. (read_initializer
)
Determines if this Read
er 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
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static