pub struct Producer<T> { /* fields omitted */ }
Producer part of ring buffer.
Returns capacity of the ring buffer.
Checks if the ring buffer is empty.
Checks if the ring buffer is full.
Appends an element to the ring buffer.
On failure returns an error containing the element that hasn't beed appended.
Appends elements from slice to the ring buffer.
Elements should be Copy
.
On success returns count of elements been appended to the ring buffer.
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.
Reads at most count
bytes
from Read
instance
and appends them to the ring buffer.
If count
is None
then as much as possible bytes will be read.
pub unsafe fn push_access<R, E, F>( &mut self, f: F ) -> Result<Result<(usize, R), E>, PushAccessError> where R: Sized, E: Sized, F: FnOnce(&mut [T], &mut [T]) -> Result<(usize, R), E>, | [src] |
Allows to write into 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 written, and some arbitrary data.
- On failure: some another arbitrary data.
On success returns data returned from f
.
Write a buffer into this writer, returning how many bytes were written. Read more
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Attempts to write an entire buffer into this writer. 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
🔬 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