pub struct SlipWriter<W> { /* private fields */ }Expand description
Writer wrapper that encodes outgoing frames as SLIP before forwarding them to the underlying writer.
The wrapper does not buffer beyond the escaping that SLIP requires. Each call to write_frame
appends a single SLIP frame to the wrapped writer. See examples/stream.rs for a runnable demonstration.
Implementations§
Source§impl<W> SlipWriter<W>
impl<W> SlipWriter<W>
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consume the wrapper and return the inner writer.
Source§impl<W: Write> SlipWriter<W>
impl<W: Write> SlipWriter<W>
Sourcepub fn write_frame(&mut self, payload: &[u8]) -> Result<()>
pub fn write_frame(&mut self, payload: &[u8]) -> Result<()>
Encode the provided payload as a SLIP frame and write it to the underlying sink.
Sourcepub fn write_frame_iter<I>(&mut self, payload: I) -> Result<()>where
I: IntoIterator<Item = u8>,
pub fn write_frame_iter<I>(&mut self, payload: I) -> Result<()>where
I: IntoIterator<Item = u8>,
Encode any iterator of bytes as a SLIP frame and write it to the underlying sink.
Auto Trait Implementations§
impl<W> Freeze for SlipWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for SlipWriter<W>where
W: RefUnwindSafe,
impl<W> Send for SlipWriter<W>where
W: Send,
impl<W> Sync for SlipWriter<W>where
W: Sync,
impl<W> Unpin for SlipWriter<W>where
W: Unpin,
impl<W> UnwindSafe for SlipWriter<W>where
W: 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