Struct embassy_sync::pipe::Reader
source · pub struct Reader<'p, M, const N: usize>where
M: RawMutex,{ /* private fields */ }
Expand description
Read-only access to a Pipe
.
Implementations§
source§impl<'p, M, const N: usize> Reader<'p, M, N>where
M: RawMutex,
impl<'p, M, const N: usize> Reader<'p, M, N>where
M: RawMutex,
sourcepub fn read<'a>(&'a self, buf: &'a mut [u8]) -> ReadFuture<'a, M, N> ⓘ
pub fn read<'a>(&'a self, buf: &'a mut [u8]) -> ReadFuture<'a, M, N> ⓘ
Read some bytes from the pipe.
See Pipe::read()
sourcepub fn try_read(&self, buf: &mut [u8]) -> Result<usize, TryReadError>
pub fn try_read(&self, buf: &mut [u8]) -> Result<usize, TryReadError>
Attempt to immediately read some bytes from the pipe.
See Pipe::try_read()
sourcepub fn fill_buf(&mut self) -> FillBufFuture<'_, M, N> ⓘ
pub fn fill_buf(&mut self) -> FillBufFuture<'_, M, N> ⓘ
Return the contents of the internal buffer, filling it with more data from the inner reader if it is empty.
If no bytes are currently available to read, this function waits until at least one byte is available.
If the reader is at end-of-file (EOF), an empty slice is returned.
sourcepub fn try_fill_buf(&mut self) -> Result<&[u8], TryReadError>
pub fn try_fill_buf(&mut self) -> Result<&[u8], TryReadError>
Try returning contents of the internal buffer.
If no bytes are currently available to read, this function returns Err(TryReadError::Empty)
.
If the reader is at end-of-file (EOF), an empty slice is returned.
Trait Implementations§
source§impl<M: RawMutex, const N: usize> BufRead for Reader<'_, M, N>
impl<M: RawMutex, const N: usize> BufRead for Reader<'_, M, N>
source§impl<M: RawMutex, const N: usize> Read for Reader<'_, M, N>
impl<M: RawMutex, const N: usize> Read for Reader<'_, M, N>
source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read more