Struct stdio::StdioReadGuard
source · pub struct StdioReadGuard<'a> { /* private fields */ }
Expand description
StdioReadGuard
acts like MutexGuard
, it locks the underlying ring buffer during its
lifetime, and provides reading methods to the ring buffer. The lock will be automatically
released on dropping of this structure.
Implementations§
source§impl<'a> StdioReadGuard<'a>
impl<'a> StdioReadGuard<'a>
Trait Implementations§
source§impl<'a> Read for StdioReadGuard<'a>
impl<'a> Read for StdioReadGuard<'a>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read from the ring buffer. Returns the number of bytes read.
Currently it is not possible to return an error, but one should not assume that because it is subject to change in the future.
Note that this method will block until at least one byte is available to be read. It will only return zero under one of two scenarios:
- The EOF flag has been set.
- The buffer specified was 0 bytes in length.
§fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to
buf
. Read more§unsafe fn initializer(&self) -> Initializer
unsafe fn initializer(&self) -> Initializer
Determines if this
Read
er can work with buffers of uninitialized
memory. Read more§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill
buf
. Read more§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read moreAuto Trait Implementations§
impl<'a> !RefUnwindSafe for StdioReadGuard<'a>
impl<'a> Send for StdioReadGuard<'a>
impl<'a> Sync for StdioReadGuard<'a>
impl<'a> Unpin for StdioReadGuard<'a>
impl<'a> !UnwindSafe for StdioReadGuard<'a>
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