Struct futures::io::LineWriter
source · [−]pub struct LineWriter<W> where
W: AsyncWrite, { /* private fields */ }
Expand description
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
sourceimpl<W> LineWriter<W> where
W: AsyncWrite,
impl<W> LineWriter<W> where
W: AsyncWrite,
sourcepub fn new(inner: W) -> LineWriter<W>
pub fn new(inner: W) -> LineWriter<W>
Create a new LineWriter
with default buffer capacity. The default is currently 1KB
which was taken from std::io::LineWriter
sourcepub fn with_capacity(capacity: usize, inner: W) -> LineWriter<W>
pub fn with_capacity(capacity: usize, inner: W) -> LineWriter<W>
Creates a new LineWriter
with the specified buffer capacity.
Trait Implementations
sourceimpl<W> AsyncWrite for LineWriter<W> where
W: AsyncWrite,
impl<W> AsyncWrite for LineWriter<W> where
W: AsyncWrite,
sourcefn poll_flush(
self: Pin<&mut LineWriter<W>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
fn poll_flush(
self: Pin<&mut LineWriter<W>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
Forward to buf_writer
’s BufWriter::poll_flush()
sourcefn poll_close(
self: Pin<&mut LineWriter<W>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
fn poll_close(
self: Pin<&mut LineWriter<W>>,
cx: &mut Context<'_>
) -> Poll<Result<(), Error>>
Forward to buf_writer
’s BufWriter::poll_close()
sourceimpl<W> Debug for LineWriter<W> where
W: Debug + AsyncWrite,
impl<W> Debug for LineWriter<W> where
W: Debug + AsyncWrite,
impl<'__pin, W> Unpin for LineWriter<W> where
W: AsyncWrite,
__Origin<'__pin, W>: Unpin,
Auto Trait Implementations
impl<W> RefUnwindSafe for LineWriter<W> where
W: RefUnwindSafe,
impl<W> Send for LineWriter<W> where
W: Send,
impl<W> Sync for LineWriter<W> where
W: Sync,
impl<W> UnwindSafe for LineWriter<W> where
W: UnwindSafe,
Blanket Implementations
sourceimpl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for W where
W: AsyncWrite + ?Sized,
sourcefn flush(&mut self) -> Flush<'_, Self>ⓘNotable traits for Flush<'_, W>impl<'_, W> Future for Flush<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>ⓘNotable traits for Flush<'_, W>impl<'_, W> Future for Flush<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
Creates a future which will entirely flush this AsyncWrite
. Read more
sourcefn close(&mut self) -> Close<'_, Self>ⓘNotable traits for Close<'_, W>impl<'_, W> Future for Close<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>ⓘNotable traits for Close<'_, W>impl<'_, W> Future for Close<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
Creates a future which will entirely close this AsyncWrite
.
sourcefn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>ⓘNotable traits for Write<'_, W>impl<'_, W> Future for Write<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
where
Self: Unpin,
fn write(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>ⓘNotable traits for Write<'_, W>impl<'_, W> Future for Write<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
Creates a future which will write bytes from buf
into the object. Read more
sourcefn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self>ⓘNotable traits for WriteVectored<'_, W>impl<'_, W> Future for WriteVectored<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
where
Self: Unpin,
fn write_vectored(
&'a mut self,
bufs: &'a [IoSlice<'a>]
) -> WriteVectored<'a, Self>ⓘNotable traits for WriteVectored<'_, W>impl<'_, W> Future for WriteVectored<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<usize, Error>;
Creates a future which will write bytes from bufs
into the object using vectored
IO operations. Read more
sourcefn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self>ⓘNotable traits for WriteAll<'_, W>impl<'_, W> Future for WriteAll<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
fn write_all(&'a mut self, buf: &'a [u8]) -> WriteAll<'a, Self>ⓘNotable traits for WriteAll<'_, W>impl<'_, W> Future for WriteAll<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
Write data into this object. Read more
sourcefn write_all_vectored(
&'a mut self,
bufs: &'a mut [IoSlice<'a>]
) -> WriteAllVectored<'a, Self>ⓘNotable traits for WriteAllVectored<'_, W>impl<'_, W> Future for WriteAllVectored<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
fn write_all_vectored(
&'a mut self,
bufs: &'a mut [IoSlice<'a>]
) -> WriteAllVectored<'a, Self>ⓘNotable traits for WriteAllVectored<'_, W>impl<'_, W> Future for WriteAllVectored<'_, W> where
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
where
Self: Unpin,
W: AsyncWrite + Unpin + ?Sized, type Output = Result<(), Error>;
Attempts to write multiple buffers into this writer. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more