pub trait Read {
// Required method
fn read(&self, fd: Fd, buffer: &mut [u8]) -> Result<usize>;
}Expand description
Trait for reading from file descriptors
Required Methods§
Sourcefn read(&self, fd: Fd, buffer: &mut [u8]) -> Result<usize>
fn read(&self, fd: Fd, buffer: &mut [u8]) -> Result<usize>
Reads from the file descriptor.
This is a thin wrapper around the read system
call.
If successful, returns the number of bytes read.
This function may perform blocking I/O, especially if the O_NONBLOCK
flag is not set for the FD. Use SharedSystem::read_async to support
concurrent I/O in an async function context.
TODO: This function should return a Future to support simulating
blocking I/O in virtual systems.