Trait rb::RbProducer
source · [−]pub trait RbProducer<T> {
fn write(&self, data: &[T]) -> Result<usize>;
fn write_blocking(&self, data: &[T]) -> Option<usize>;
fn write_blocking_timeout(
&self,
data: &[T],
timeout: Duration
) -> Result<Option<usize>>;
}
Expand description
Defines write methods for a producer view.
Required Methods
Stores the given slice of data into the ring buffer. Returns the number of written elements or an error.
Possible errors:
RbError::Full
fn write_blocking(&self, data: &[T]) -> Option<usize>
fn write_blocking(&self, data: &[T]) -> Option<usize>
Works analog to write
but blocks until there are free slots in the ring buffer.
The number of actual blocks written is returned in the Option
value.
Returns None
if the given slice has zero length.
Works analog to write_blocking
but eventually returns if the specified timeout is reached.
The number of actual blocks written is returned in the Ok(Option)
value.
Returns Ok(None)
if the given slice has zero length.
Possible errors:
RbError::TimedOut