pub struct InfallibleCallbackWriteWords<Callback> { /* private fields */ }
Expand description
Adapter that turns an infallible callback into an infallible data sink.
Wraps a callback function from Word
to ()
and implements WriteWords<Word, WriteError=Infallible>
by calling the callback each time a client writes
to it.
See also FallibleCallbackWriteWords
, and module-level documentation for a
detailed usage example.
Implementations§
source§impl<Callback> InfallibleCallbackWriteWords<Callback>
impl<Callback> InfallibleCallbackWriteWords<Callback>
sourcepub fn into_inner(self) -> Callback
pub fn into_inner(self) -> Callback
Consumes the adapter and returns the provided callback.
Trait Implementations§
source§impl<Callback: Clone> Clone for InfallibleCallbackWriteWords<Callback>
impl<Callback: Clone> Clone for InfallibleCallbackWriteWords<Callback>
source§fn clone(&self) -> InfallibleCallbackWriteWords<Callback>
fn clone(&self) -> InfallibleCallbackWriteWords<Callback>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<Callback: Debug> Debug for InfallibleCallbackWriteWords<Callback>
impl<Callback: Debug> Debug for InfallibleCallbackWriteWords<Callback>
source§impl<Word, Callback> WriteWords<Word> for InfallibleCallbackWriteWords<Callback>where
Callback: FnMut(Word),
impl<Word, Callback> WriteWords<Word> for InfallibleCallbackWriteWords<Callback>where
Callback: FnMut(Word),
§type WriteError = Infallible
type WriteError = Infallible
The error type that can occur when writing to the data sink, or
Infallible
. Read moresource§fn write(&mut self, word: Word) -> Result<(), Infallible>
fn write(&mut self, word: Word) -> Result<(), Infallible>
Writes a single
Word
to the data sink and advances the state of the data sink
accordingly (i.e., so that the next write
won’t overwrite the current Word
).source§fn extend_from_iter(
&mut self,
iter: impl Iterator<Item = Word>
) -> Result<(), Self::WriteError>
fn extend_from_iter( &mut self, iter: impl Iterator<Item = Word> ) -> Result<(), Self::WriteError>
Writes a sequence of
Word
s to the data sink, short-circuiting on error. Read moresource§fn maybe_full(&self) -> bool
fn maybe_full(&self) -> bool
Returns
true
if the data sink could be full Read moreAuto Trait Implementations§
impl<Callback> RefUnwindSafe for InfallibleCallbackWriteWords<Callback>where
Callback: RefUnwindSafe,
impl<Callback> Send for InfallibleCallbackWriteWords<Callback>where
Callback: Send,
impl<Callback> Sync for InfallibleCallbackWriteWords<Callback>where
Callback: Sync,
impl<Callback> Unpin for InfallibleCallbackWriteWords<Callback>where
Callback: Unpin,
impl<Callback> UnwindSafe for InfallibleCallbackWriteWords<Callback>where
Callback: UnwindSafe,
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