[−][src]Struct ringbuf::Consumer
Consumer part of ring buffer.
Methods
impl<T: Sized> Consumer<T>
[src]
impl<T: Sized> Consumer<T>
pub fn capacity(&self) -> usize | [src] |
Returns capacity of the ring buffer.
pub fn is_empty(&self) -> bool | [src] |
Checks if the ring buffer is empty.
pub fn is_full(&self) -> bool | [src] |
Checks if the ring buffer is full.
pub fn pop(&mut self) -> Result<T, PopError> | [src] |
Removes first element from the ring buffer and returns it.
impl<T: Sized + Copy> Consumer<T>
[src]
impl<T: Sized + Copy> Consumer<T>
pub fn pop_slice(&mut self, elems: &mut [T]) -> Result<usize, PopSliceError> | [src] |
Removes first elements from the ring buffer and writes them into a slice.
Elements should be Copy
.
On success returns count of elements been removed from the ring buffer.
pub fn move_slice( | [src] |
Removes at most count
elements from the Consumer
of the ring buffer
and appends them to the Producer
of the another one.
If count
is None
then as much as possible elements will be moved.
Elements should be Copy
.
On success returns count of elements been moved.
impl Consumer<u8>
[src]
impl Consumer<u8>
pub fn write_into( | [src] |
Removes at most first count
bytes from the ring buffer and writes them into
a Write
instance.
If count
is None
then as much as possible bytes will be written.
impl<T: Sized> Consumer<T>
[src]
impl<T: Sized> Consumer<T>
pub unsafe fn pop_access<R, E, F>( | [src] |
Allows to read from ring buffer memory directry.
This function is unsafe beacuse it gives access to possibly uninitialized memory and transfers to the user the 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
.
Trait Implementations
impl Read for Consumer<u8>
[src]
impl Read for Consumer<u8>
fn read(&mut self, buffer: &mut [u8]) -> Result<usize> | [src] |
unsafe fn initializer(&self) -> Initializer | [src] |
read_initializer
)Determines if this Read
er can work with buffers of uninitialized memory. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error> | 1.0.0 [src] |
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error> | 1.0.0 [src] |
Read all bytes until EOF in this source, appending them to buf
. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> | 1.6.0 [src] |
Read the exact number of bytes required to fill buf
. Read more
fn by_ref(&mut self) -> &mut Self | 1.0.0 [src] |
Creates a "by reference" adaptor for this instance of Read
. Read more
fn bytes(self) -> Bytes<Self> | 1.0.0 [src] |
Transforms this Read
instance to an [Iterator
] over its bytes. Read more
fn chain<R>(self, next: R) -> Chain<Self, R> where | 1.0.0 [src] |
Creates an adaptor which will chain this stream with another. Read more
fn take(self, limit: u64) -> Take<Self> | 1.0.0 [src] |
Creates an adaptor which will read at most limit
bytes from it. Read more
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |