Skip to main content

Module io

Module io 

Source
Expand description

I/O operations.

If you’re looking for SeekFrom, it’s in the fs module.

Structs§

DupFlagsNon-WASI
O_* constants for use with dup2.
Errno
errno—An error code.
FdFlags
FD_* constants for use with fcntl_getfd and fcntl_setfd.
IoSliceNon-Windows
A buffer type used with Write::write_vectored.
IoSliceMutNon-Windows
A buffer type used with Read::read_vectored.
ReadWriteFlagslinux_kernel and non-Android
RWF_* constants for use with preadv2 and pwritev2.

Functions§

close
close(raw_fd)—Closes a RawFd directly.
dupNon-Windows and non-WASI
dup(fd)—Creates a new OwnedFd instance that shares the same underlying file description as fd.
dup2Non-Windows and non-WASI
dup2(fd, new)—Changes the file description of a file descriptor.
dup3Non-Windows and neither target_os=aix nor target_os=espidf nor target_os=horizon nor target_os=nto nor target_os=vita nor WASI
dup3(fd, new, flags)—Changes the file description of a file descriptor, with flags.
fcntl_dupfd_cloexecNon-Windows and neither target_os=espidf nor WASI
fcntl(fd, F_DUPFD_CLOEXEC)—Creates a new OwnedFd instance, with value at least min, that has O_CLOEXEC set and that shares the same underlying file description as fd.
fcntl_getfdNon-Windows
fcntl(fd, F_GETFD)—Returns a file descriptor’s flags.
fcntl_setfdNon-Windows
fcntl(fd, F_SETFD, flags)—Sets a file descriptor’s flags.
ioctl_fioclexapple or linux_kernel
ioctl(fd, FIOCLEX, NULL)—Set the close-on-exec flag.
ioctl_fionbio
ioctl(fd, FIONBIO, &value)—Enables or disables non-blocking mode.
ioctl_fionclexapple or linux_kernel
ioctl(fd, FIONCLEX, NULL)—Remove the close-on-exec flag.
ioctl_fionreadNeither target_os=espidf nor target_os=horizon nor target_os=vita
ioctl(fd, FIONREAD)—Returns the number of bytes ready to be read.
preadNon-Windows
pread(fd, buf, offset)—Reads from a file at a given position.
preadvNeither Windows nor Cygwin nor target_os=espidf nor Haiku nor target_os=horizon nor target_os=nto nor Redox nor Solaris nor target_os=vita
preadv(fd, bufs, offset)—Reads from a file at a given position into multiple buffers.
preadv2linux_kernel and non-Android
preadv2(fd, bufs, offset, flags)—Reads data, with several options.
pwriteNon-Windows
pwrite(fd, bufs)—Writes to a file at a given position.
pwritevNeither Windows nor Cygwin nor target_os=espidf nor Haiku nor target_os=horizon nor target_os=nto nor Redox nor Solaris nor target_os=vita
pwritev(fd, bufs, offset)—Writes to a file at a given position from multiple buffers.
pwritev2linux_kernel and non-Android
pwritev2(fd, bufs, offset, flags)—Writes data, with several options.
read
read(fd, buf)—Reads from a stream.
readvNeither Windows nor target_os=espidf nor target_os=horizon
readv(fd, bufs)—Reads from a stream into multiple buffers.
retry_on_intr
Call f until it either succeeds or fails other than Errno::INTR.
write
write(fd, buf)—Writes to a stream.
writevNeither Windows nor target_os=espidf nor target_os=horizon
writev(fd, bufs)—Writes to a stream from multiple buffers.

Type Aliases§

Result
A specialized Result type for rustix APIs.