[][src]Struct sgx_tstd::io::LineWriter

pub struct LineWriter<W: Write> { /* fields omitted */ }

Wraps a writer and buffers output to it, flushing whenever a newline (0x0a, '\n') is detected.

The BufWriter struct wraps a writer and buffers its output. But it only does this batched write when it goes out of scope, or when the internal buffer is full. Sometimes, you'd prefer to write each line as it's completed, rather than the entire buffer at once. Enter LineWriter. It does exactly that.

Like BufWriter, a LineWriter’s buffer will also be flushed when the LineWriter goes out of scope or when its internal buffer is full.

If there's still a partial line in the buffer when the LineWriter is dropped, it will flush those contents.


impl<W: Write> LineWriter<W>[src]

pub fn new(inner: W) -> LineWriter<W>[src]

Creates a new LineWriter.

pub fn with_capacity(capacity: usize, inner: W) -> LineWriter<W>[src]

Creates a new LineWriter with a specified capacity for the internal buffer.

pub fn get_ref(&self) -> &W[src]

Gets a reference to the underlying writer.

pub fn get_mut(&mut self) -> &mut W[src]

Gets a mutable reference to the underlying writer.

Caution must be taken when calling methods on the mutable reference returned as extra writes could corrupt the output stream.

pub fn into_inner(self) -> Result<W, IntoInnerError<LineWriter<W>>>[src]

Unwraps this LineWriter, returning the underlying writer.

The internal buffer is written out before returning the writer.


An Err will be returned if an error occurs while flushing the buffer.

Trait Implementations

impl<W: Write> Debug for LineWriter<W> where
    W: Debug

impl<W: Write> Write for LineWriter<W>[src]

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> Unpin for LineWriter<W> where
    W: Unpin

impl<W> UnwindSafe for LineWriter<W> where
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.