Struct LineWriter
struct LineWriter<W: AsyncWrite> { ... }
Wrap a writer, like BufWriter does, but prioritizes buffering lines
This was written based on std::io::LineWriter which goes into further details
explaining the code.
Buffering is actually done using BufWriter. This class will leverage BufWriter
to write on-each-line.
Implementations
impl<W: AsyncWrite> LineWriter<W>
fn new(inner: W) -> SelfCreate a new
LineWriterwith default buffer capacity. The default is currently 1KB which was taken fromstd::io::LineWriterfn with_capacity(capacity: usize, inner: W) -> SelfCreates a new
LineWriterwith the specified buffer capacity.fn buffer(self: &Self) -> &[u8]Returns a reference to
buf_writer's internally buffered data.fn get_ref(self: &Self) -> &WAcquires a reference to the underlying sink or stream that this combinator is pulling from.
impl<'__pin, W: AsyncWrite> Unpin for LineWriter<W>
impl<T> Any for LineWriter<W>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for LineWriter<W>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for LineWriter<W>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for LineWriter<W>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for LineWriter<W>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for LineWriter<W>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for LineWriter<W>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<W> AsyncWriteExt for LineWriter<W>
impl<W> Freeze for LineWriter<W>
impl<W> RefUnwindSafe for LineWriter<W>
impl<W> Send for LineWriter<W>
impl<W> Sync for LineWriter<W>
impl<W> UnsafeUnpin for LineWriter<W>
impl<W> UnwindSafe for LineWriter<W>
impl<W: $crate::fmt::Debug + AsyncWrite> Debug for LineWriter<W>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<W: AsyncWrite> AsyncWrite for LineWriter<W>
fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize>>fn poll_write_vectored(self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>]) -> Poll<Result<usize>>fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>Forward to
buf_writer'sBufWriter::poll_flush()fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>Forward to
buf_writer'sBufWriter::poll_close()