pub struct Consumer<'a> { /* private fields */ }Expand description
Reads data previously written to the buffer.
Returned by crate::init. Use Consumer::read to get a GrantR for accessing
the buffered data, then call GrantR::release to mark bytes as consumed.
With the async-await feature, use Consumer::wait_for_data to asynchronously
wait for new data to be available.
Implementations§
Source§impl Consumer<'_>
impl Consumer<'_>
Sourcepub fn read(&mut self) -> GrantR<'_, '_>
pub fn read(&mut self) -> GrantR<'_, '_>
Read data from the buffer.
If the data available to read crosses the end of the ring, this function may provide a smaller slice. Only after releasing the data up to the end of the ring will the next call provide more data.
Sourcepub async fn wait_for_data(&mut self)
pub async fn wait_for_data(&mut self)
Waits until there is data in the Consumer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Consumer<'a>
impl<'a> !RefUnwindSafe for Consumer<'a>
impl<'a> !Sync for Consumer<'a>
impl<'a> Unpin for Consumer<'a>
impl<'a> !UnwindSafe for Consumer<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more