pub trait Write {
// Required method
fn write(&self, fd: Fd, buffer: &[u8]) -> Result<usize>;
}Expand description
Trait for writing to file descriptors
Required Methods§
Sourcefn write(&self, fd: Fd, buffer: &[u8]) -> Result<usize>
fn write(&self, fd: Fd, buffer: &[u8]) -> Result<usize>
Writes to the file descriptor.
This is a thin wrapper around the write system
call.
If successful, returns the number of bytes written.
This function may write only part of the buffer and block if the
O_NONBLOCK flag is not set for the FD. Use SharedSystem::write_all
to support concurrent I/O in an async function context and ensure the
whole buffer is written.
TODO: This function should return a Future to support simulating
blocking I/O in virtual systems.