pub struct PipeReader { /* private fields */ }Expand description
The read end of a kernel pipe.
Implementations§
Source§impl PipeReader
impl PipeReader
Sourcepub fn read(&self, buf: &mut [u8]) -> Result<usize, KernelError>
pub fn read(&self, buf: &mut [u8]) -> Result<usize, KernelError>
Read up to buf.len() bytes from the pipe.
Returns the number of bytes read. Returns 0 when the write end is closed and the buffer is empty (EOF). Spins briefly if the buffer is empty but the write end is still open.
Sourcepub fn try_read(&self, buf: &mut [u8]) -> Result<usize, KernelError>
pub fn try_read(&self, buf: &mut [u8]) -> Result<usize, KernelError>
Non-blocking read: return immediately if no data available.