Struct std::io::unix::FileDescriptor
Platform specific file descriptor.
On UNIX platforms this is a wrapper over an integer.
Fields
-
value: c_int
Methods
impl FileDescriptor { ... }
-
fn new(value: c_int) -> FileDescriptor
Create a
FileDescriptor
object from a raw file descriptor. -
fn close(self: &mut FileDescriptor) -> Result<()>
Close the file descriptor.
-
fn as_fd(self: &FileDescriptor) -> FileDescriptor
-
fn set_nonblocking(self: &mut FileDescriptor, nonblocking: bool) -> Result<()>
Sets the file descriptor blocking mode.
-
fn set_cloexec(self: &mut FileDescriptor) -> Result<()>
Sets whether the file descriptor is closed on exec.
-
fn move(self: &mut FileDescriptor) -> FileDescriptor
Mixins
impl FileDescriptor { ... }
-
mixin FdReadWrite<FileDescriptor>
-
Reads from the stream into a provided buffer.
If successful, returns the number of bytes read. This may be less than the size of the provided buffer.
-
Write the buffer to the stream.
Returns the number of bytes written. This may be less than the size of the buffer. See also write_all, which can be used to write the entire buffer.
-
mixin Readable<FileDescriptor>
-
Fills the provided buffer by reading from the stream.
If stream had less bytes available than the size of the buffer, this method will return an
Error::eof()
. -
Reads the entire stream into a
StringBuf
.If successful, returns the number of bytes that were read.
-
mixin Writable<FileDescriptor>
-
Writes all the bytes in the buffer to the stream.
If EOF is reached, returns
Error::eof()
.