Skip to main content

Write

Trait Write 

Source
pub trait Write {
    // Required method
    fn write(&self, fd: Fd, buffer: &[u8]) -> Result<usize>;
}
Expand description

Trait for writing to file descriptors

Required Methods§

Source

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.

Implementors§

Source§

impl Write for RealSystem

Source§

impl Write for VirtualSystem

Source§

impl<T: Write> Write for SharedSystem<T>

Delegates Write methods to the contained implementor.