Struct stdio::StdioWriteGuard

source ·
pub struct StdioWriteGuard<'a> { /* private fields */ }
Expand description

StdioReadGuard acts like MutexGuard, it locks the underlying ring buffer during its lifetime, and provides writing methods to the ring buffer. The lock will be automatically released on dropping of this structure.

Implementations§

source§

impl<'a> StdioWriteGuard<'a>

source

pub fn set_eof(&mut self)

Set the EOF flag of the queue to true.

Trait Implementations§

source§

impl<'a> Write for StdioWriteGuard<'a>

source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Write to the ring buffer, returniong the number of bytes written.

When this method is called after setting the EOF flag, it returns error with ErrorKind set to UnexpectedEof.

Also note that this method does not guarantee to write all given bytes, although it currently does so. Always check the return value when using this method. Otherwise, use write_all to ensure that all given bytes are written.

source§

fn flush(&mut self) -> Result<(), Error>

The function required by Write trait. Currently it performs nothing, since everything is write directly to the ring buffer in write method.

§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error encountered. Read more
§

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

Creates a “by reference” adaptor for this instance of Write. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for StdioWriteGuard<'a>

§

impl<'a> Send for StdioWriteGuard<'a>

§

impl<'a> Sync for StdioWriteGuard<'a>

§

impl<'a> Unpin for StdioWriteGuard<'a>

§

impl<'a> !UnwindSafe for StdioWriteGuard<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.