Skip to main content

Module _sys

Module _sys 

Source
Expand description

System interfaces and hardware abstractions.
sys::{arch, device, env, fs, io, log, mem, net, os, service}

All sys module’s items flat re-exported.

Macros§

ansilinux or std
🮖 Concatenates or prints Ansi escape codes.
arch_cmpavx and dep_safe_arch
🖥️ safe_arch Turns a comparison operator token to the correct constant value.
arch_roundavx and dep_safe_arch
🖥️ safe_arch Turns a round operator token to the correct constant value.
asm
🖥️ core Inline assembly.
const_join
Joins multiple byte slices or string slices in compile-time.
cswap
Swaps two mutable variables in a compile-time friendly manner.
detect_aarch64std and (AArch64 or ARM64EC)
🖥️ std Tests at runtime whether an aarch64 feature is enabled.
detect_x86std and (x86 or x86-64)
🖥️ std Tests at runtime whether an x86/x86-64 feature is enabled.
env_
core Inspects an environment variable at compile time.
global_asm
🖥️ core Module-level inline assembly.
linux_entrylinux
🐧 Defines the program entry point and main fn translation layer for Linux systems.
offset_of
🫗 core Expands to the offset in bytes of a field from the beginning of the given type.
option_env
core Optionally inspects an environment variable at compile time.
pin
🫗 🍃 core Constructs a Pin<&mut T>, by pinning a value: T locally.
size_of_expr
🫗 Returns the size of an expression in bytes.
slice
🛠️ Invokes Slice range methods using short notation.
slogunsafe_sync
🪵 Static global logger macro, compile-time friendly.

Structs§

Alloc
🧺 🛠️ Memory-allocation-related operations.
Alsaalsa
🔊 🐧 🛠️ ALSA operations.
AlsaPcmHandlealsa
🔊 🐧 🔒 Owned ALSA PCM stream handle.
Ansiterm
🮖 🛠️ ANSI escape codes.
AnsiColor8term
🮖 🎨 ANSI 8-bit color codes, 256 colors.
AnsiLinkterm
🮖 🌐 🧶 A terminal hyperlink using the OSC 8 escape sequence.
AnsiOscterm
🮖 🧶 An OSC sequence with semicolon-separated fields.
AppApplestd
🍏 Apple enviroment for directories.
AppConfigstd
🖥️ Application specific metadata.
AppUnixstd
🐚 Unix enviroment for directories.
AppWindowsstd
🪟 Windows enviroment for directories.
AppXdgstd
🐧 Xdg enviroment for directories.
Arch
🖥️ 🛠️ Arch-related functionality.
AudioDevice
🔊 🔌 Borrowed description of an audio endpoint.
AudioDeviceCowalloc
🔊 🔌 Owned or borrowed description of an audio endpoint.
BareBox
🫗 A no-op pointer type, like a Box but without affecting how T is stored.
Boxalloc
🫗 alloc A pointer type that uniquely owns a heap allocation of type T.
Boxedalloc
🫗 A zero-sized marker for a Storage type that wraps its data in a Box.
BumpAllocalloc and unsafe_layout
🧺 A simple, single-threaded bump allocator.
CacheAlign
🫗 Aligns and pads a value to the length of a cache line.
Cell
🫗 core A mutable memory location.
Currentstd and unsafe_layout
🔒 A marker object representing the current instance of a type T.
CurrentGuardstd and unsafe_layout
🔒 A guard that temporarily sets a global current ptr for T, restoring the old one on drop.
DirBuilderstd
📁 std A builder used to create directories in various manners.
DirEntrystd
📁 std Entries returned by the ReadDir iterator.
Discriminant
🫗 core Opaque type representing the discriminant of an enum.
Env
🛠️ A namespaced wrapper for std::env functions and constants.
FatPtrunsafe_layout
🫗 Represents a fat pointer with separate data and metadata pointers.
FdBorrowedstd
📁 🍃 std A borrowed file descriptor.
FdOwnedstd
📁 🔒 std An owned file descriptor.
Filestd
📁 std An object providing access to an open file on the filesystem.
FileMetadatastd
📁 std Metadata information about a file.
FileOpenOptionsstd
📁 std Options and flags which can be used to configure how a file is opened.
FilePermissionsstd
📁 std Representation of the various permissions on a file.
FileTimesstd
📁 std Representation of the various timestamps on a file.
FileTypestd
📁 std Represents a type of file with accessors for each file type.
Fsstd
📁 🛠️ Filesystem-related operations.
FsPathstd
📁 🛠️ A more featureful wrapper over PathBuf.
Httphttp
📡 HTTP protocol operations.
HttpRequestLinehttp
📡 ::= 🍃 Borrowed HTTP request line.
HttpResponseHeadhttp
📡 HTTP response head.
HttpStatushttp
📡 HTTP response status code.
Iostd, or io and non-std
🔌 🛠️ I/O-related operations.
IoBufReader
🔌 ?std Adds buffering to any reader.
IoBufWriter
🔌 ?std Wraps a writer and buffers its output.
IoBytes
🔌 ?std An iterator over u8 values of a reader.
IoChain
🔌 ?std Adapter to chain together two readers.
IoCursor
🔌 ?std Wraps an in-memory buffer and provides it with an IoSeek implementation.
IoEmpty
🔌 ?std Ignores any data written via IoWrite, and read via IoRead.
IoError
🔌 🚩+ ?std Error type for IoRead, IoWrite, IoSeek operations.
IoIntoInnerErrorstd
🔌 🚩 std An error returned by IoBufWriter::into_inner
IoLineWriter
🔌 ?std Like BufWriter, but flushing whenever a newline (0x0a, ' ') is detected.
IoLinesstd
🔌 std An iterator over the lines of an instance of IoBufRead.
IoPipeReaderstd
🔌 std Read end of an anonymous pipe.
IoPipeWriterstd
🔌 std Write end of an anonymous pipe.
IoRepeat
🔌 ?std A reader which yields one byte over and over and over and over and over and…
IoSinkstd
🔌 std A writer which will move data into the void.
IoSlicestd
🔌 std A buffer type used with IoWrite::write_vectored.
IoSliceMutstd
🔌 std A buffer type used with IoRead::read_vectored.
IoSplitstd
🔌 std An iterator over the contents of an instance of BufRead split on a particular byte.
IoTake
🔌 ?std Reader adapter which limits the bytes read from an underlying reader.
Ipv4Addr
📡 core An IPv4 address.
Ipv6Addr
📡 core An IPv6 address.
IterArgsOsRefstd and unsafe_ffi
🔄 🍃 ⚠️ Iterator over references of command line arguments.
IterDirReadstd
📁 🔄 std Iterator over the entries in a directory.
JoinPathsErrorstd
🚩 🖥️ std Returned from Env::join_paths.
LINUX_ERRNOlinux
🐧 🚩+ Linux sys/errno.h constants.
LINUX_EXITlinux
🐧 ⚖️ Standard exit codes for Linux processes
LINUX_F_CMDlinux
🐧 📁 Linux File descriptor commands (for fcntl).
LINUX_IOCTLlinux
🐧 📁 Linux ioctl constants.
LazyCell
🫗 🌱 core A value which is initialized on the first access.
Libcunsafe_ffi
🖥️ 🛠️ Raw C/POSIX system interfaces exposed through the platform’s libc.
Linuxlinux
🐧 🛠️ Linux-related operations.
LinuxFdlinux
🐧 📁 🔻 An owned Linux file descriptor.
LinuxInstantlinux and time
🐧 🕘 A fast monotonic Linux time source.
LinuxMmapAllocLinux and alloc and unsafe_ffi and unsafe_layout
🐧 🧺 A Linux global memory allocator backed directly by anonymous mmap.
LinuxOpenOptionslinux
🐧 📁 Options used to open a Linux file descriptor.
LinuxPipelinux
🐧 📁 🔌 An owned Linux anonymous pipe.
LinuxPipeFlagslinux
🐧 📁 🔌 Flags used when creating a Linux pipe.
LinuxSigactionlinux
🐧 📶 🔻 Examine and change a signal action.
LinuxSigactionFlagslinux
🐧 📶 Input flags for LinuxSigaction.
LinuxSiginfolinux
🐧 📶 🔻 Additional information about a signal.
LinuxSignalSetlinux
🐧 📶 A compact semantic set of standard Linux signals.
LinuxSigsetlinux
🐧 📶 🔻 A raw Linux kernel signal mask.
LinuxStatlinux
🐧 📁 🔻 File status structure matching libc’s stat (man 2 stat)
LinuxTermioslinux
🐧 🮖 🔻 Represents the termios structure from libc, used to control terminal I/O.
LinuxTermiosCclinux
🐧 🮖 A symbolic index into LinuxTermios::c_cc.
LinuxTermiosControlFlagslinux
🐧 🮖 LinuxTermios control flags.
LinuxTermiosInputFlagslinux
🐧 🮖 LinuxTermios input flags.
LinuxTermiosLocalFlagslinux
🐧 🮖 LinuxTermios local flags.
LinuxTermiosOutputFlagslinux
🐧 🮖 LinuxTermios output flags.
LinuxTimelinux and time
🐧 🕘 A configurable family of Linux clocks.
LinuxTimespeclinux and time
🐧 🕘 🔻 Represents the libc timespec structure. Time in seconds and nanoseconds.
LoggerStatic
🪵 Fixed-capacity static logger with owned byte buffers.
ManuallyDrop
🫗 core A wrapper to inhibit compiler from automatically calling T’s destructor.
Mem
🫗 🛠️ Memory-related operations.
MemHedgeCtrl
🫗 🧵 ⚛️ Shared control plane for one hedged read request at a time.
MemHedgeRead
🫗 🧵 🍃 Binds a hedge-control cell to a replicated logical slice view.
MemLayoutalloc
🧺 alloc Layout of a block of memory.
MemLayoutErroralloc
🧺 🚩 alloc The MemLayout parameters violated constraints.
MemReplicaSlice
🫗 🍃 Mutable replicated view over a backing slice.
NetAddrParseError
📡 🚩 core An error which can be returned when parsing an IP or socket address.
OnceCell
🫗 🌱 core A cell which can nominally be written to only once.
Pathstd
📁 🍃 std A slice of a path (akin to str).
PathBufstd
📁 std An owned, mutable path (akin to String).
PathStripPrefixErrorstd
📁 🚩 std An error returned from Path::strip_prefix if the prefix was not found.
PathWindowsPrefixComponentstd
📁 🪟 std Wraps a Windows path prefix as well as its unparsed string representation.
Pin
🍃 🫗 🔒 core A pointer which pins its pointee in place.
Pinnedunsafe_ptr
🫗 🍃 A wrapper for structurally pinned data.
Ptr
🫗 🛠️ Pointer-related operations.
PtrNonNull
🫗 ⚗️ core *mut T but non-zero and covariant.
Rcalloc
🫗 🍃 alloc A single-threaded reference-counting pointer.
RcWeakalloc
🫗 🍃 alloc A version of Rc that holds a non-owning ref to the managed allocation.
Ref
🍃 core A wrapper type for an inmutably borrowed value from a RefCell<T>
RefCell
🫗 🍃 core A mutable memory location with dynamically checked borrow rules.
RefCellBorrowError
🍃 🚩 core An error returned by RefCell::try_borrow.
RefCellBorrowMutError
🍃 🚩 core An error returned by RefCell::try_borrow_mut.
RefMut
🍃 core A wrapper type for a mutably borrowed value from a RefCell<T>
Slice
🍃 🛠️ Slice-related operations, most of them const.
SliceIter
🔄 🍃 A lending iterator over a shared slice.
SliceIterMut
🔄 🍃 A lending iterator over an exclusive slice.
SocketAddrV4
📡 core An IPv4 socket address.
SocketAddrV6
📡 core An IPv6 socket address.
Stderrstd
🔌 std A handle to the standard error stream of a process.
Stdinstd
🔌 std A handle to the standard input stream of a process.
Stdoutstd
🔌 std A handle to the global standard output stream of the current process.
SystemAllocstd
🧺 std The default memory allocator provided by the operating system.
TcpListenerstd
📡 std A TCP socket server, listening for connections.
TcpStreamstd
📡 std A TCP stream between a local and a remote socket.
TermCapsterm
🮖 ▫️ Terminal capability bits.
TermCellUiterm and ui
🮖 A cell-form UI adapter for terminal grids.
TermColorterm
🮖 🎨 ▫️ A packed terminal color and its composition mode.
TermColorsterm
🮖 🎨 Packed foreground and background terminal colors.
TermGridterm
🮖 🗃️ A dense row-major grid of terminal-space elements.
TermInputParserevent and term
🮖 🎫 ::= Parses terminal input bytes into normalized events.
TermLinuxlinux and term
🮖 🐧 Linux terminal frontend.
TermLinuxRestorelinux and term
🮖 🐧 🔒 Linux terminal session restore payload.
TermModeterm
🮖 Terminal session mode request.
TermPenterm
🮖 𝐓 🎨 Reusable terminal style and colors for constructing elements.
TermRendererterm
🮖 Terminal renderer over caller-provided byte-frame storage.
TermSessionterm
🮖 🔒 Scoped terminal session guard.
TermSizeterm
🮖 🧱 🛡️ The size of the terminal.
TermStyleterm
🮖 𝐓 A compact set of broadly supported terminal text styles.
TermStyleExtterm
🮖 𝐓 A complete set of terminal text styles.
Termelterm
🮖 𝐓 🧱 🎨 🗃️ A terminal-flavored textual element.
TermelMetaterm
🮖 𝐓 🧱 ▫️ Compact terminal-cell occupancy metadata for a Termel.
UdpSocketstd
📡 std A UDP socket.
UnsafeCell
🫗 core The core primitive for interior mutability in Rust.
Wasm
🛠️ A Wasm namespace.
WasmAllocWebAssembly and alloc and unsafe_layout
🧺 A WebAssembly global memory allocator that uses a bump allocation strategy.
Webweb
🌐 🛠️ A Web API namespace.
WebCanvasUiui and web
🌐 A graphic-form UI adapter for an HTML canvas.
WebDocumentweb
🌐 🫆 Handle to the brower’s global Document associated APIs.
WebEventIngressevent and web
🎫 🌐 Pollable ingress queue for normalized web events.
WebEventKeyevent and web
🎫 🌐 A web API keyboard event.
WebEventMouseevent and web
🎫 🌐 A web API Mouse Event.
WebEventPointerevent and web
🎫 🌐 A web API Pointer Event.
WebEventWheelevent and web
🎫 🌐 A web API Wheel Event.
WebPermissionSetweb
🌐 A set of browser permission kinds.
WebPermissionSnapshotweb
🌐 A point-in-time classification of cached browser permission queries.
WebWindowweb
🌐 Handle to the browser’s global Window and Screen associated APIs.
WebWindowStateweb
🌐 Aggregates the live state of a WebWindow, including geometry and screen context.
WebWorkerweb
🌐 🫆 A handle to a JavaScript Web Worker.
WebWorkerJobweb
🌐 🫆 Represents a job running inside a WebWorker.
XCpuBufferUnix and x11
🐚 Cpu-backed pixel buffer for X11 image upload.
XDisplayUnix and x11
🐚 🔒 A connection to an X11 display server.
XEventUnix and x11
🐚 🎫 Wrapper for an XCB event.
XFrontendUnix and x11
🐚 An X11 frontend for frame-driven runtimes.
XPresentUnix and x11
🐚 Borrowed byte-backed presentation artifact for X11.
XRasterRendererUnix and x11
🐚 Projects a byte-backed X11 image scene into a borrowed presentation artifact.
XShmBufferUnix and x11
🐚 MIT-SHM-backed pixel buffer for X11 image upload.
XSurfaceFrameUnix and x11
🐚 Borrowed mutable X11 surface for direct frame rendering.
XSurfaceUiUnix and font and ui and x11
🐚 A graphic-form UI adapter for X11 pixel surfaces.
XWindowUnix and x11
🐚 🫆 🔒 X11 top-level drawable host and presentation target.
m128dep_safe_arch
🖥️ safe_arch The data for a 128-bit SSE register of four f32 lanes.
m256dep_safe_arch
🖥️ safe_arch The data for a 256-bit AVX register of eight f32 lanes.
m128ddep_safe_arch
🖥️ safe_arch The data for a 128-bit SSE register of two f64 values.
m128idep_safe_arch
🖥️ safe_arch The data for a 128-bit SSE register of integer data.
m256ddep_safe_arch
🖥️ safe_arch The data for a 256-bit AVX register of four f64 values.
m256idep_safe_arch
🖥️ safe_arch The data for a 256-bit AVX register of integer data.
w_v128WebAssembly
🖥️ 🫗 WASM-specific 128-bit wide SIMD vector type.

Enums§

AlsaErroralsa
🔊 🐧 🚩 ALSA PCM error.
AnsiColorterm
🮖 🎨 Complete ANSI color selection
AnsiColor3term
🮖 🎨 ANSI 3-bit color codes, 8 colors.
AudioDeviceDir
🔊 🧭 Direction capability of an audio endpoint.
AudioStreamDir
🔊 🧭 Direction of an audio stream.
Backing
🤷 🍃 Controls how memory is provided for a value.
Cowalloc
🫗 🍃 💱 alloc A clone-on-write smart pointer.
DiagLevel
🪵 The severity of a diagnostic emission.
HttpErrorhttp
📡 🚩 HTTP parsing and formatting error.
HttpMethodhttp
📡 HTTP request method.
HttpStatusClasshttp
📡 The response class of an HTTP status code.
HttpVersionhttp
📡 HTTP protocol version.
IoErrorKind
🔌 🚩+ ?std A list specifying general categories of I/O error.
IoSeekFrom
🔌 ?std A cursor position used by IoSeek.
IpAddr
📡 core An IP address, either IPv4 or IPv6.
LinuxClocklinux and time
🐧 🕘 🫆 Linux clock identifiers.
LinuxErrorlinux
🐧 🚩+ Represents a Linux-related error.
LinuxFileTypelinux
🐧 📁 A Linux file type.
LinuxRandomModelinux
🎲 🐧 Linux getrandom randomness mode.
LinuxSeekFromlinux
🐧 📁 A Linux file-positioning directive.
LinuxSignallinux
🐧 📶 A linux signal
LinuxTermiosCharSizelinux
🐧 🮖 A Linux termios character size.
MaybeOwned
🤷 🍃 A container that may hold either a borrowed or owned value.
MemHedgeError
🫗 🧵 🚩 Errors produced by hedged control-state operations.
MemHedgeState
🫗 🧵 ⚛️ Lifecycle state of a hedged read request.
MemReplicaError
🚩 🫗 Errors produced by replicated layout construction and access.
PathComponentstd
📁 std A single component of a path.
PathWindowsPrefixstd
📁 🪟 std Windows path prefixes, e.g., C: or \\server\share.
SocketAddr
📡 🫆 core An internet socket address, either IPv4 or IPv6.
TcpShutdownstd
📡 std Possible values which can be passed to the TcpStream::shutdown method.
TermCapterm
🮖 Terminal capability flag.
TermColorKindterm
🮖 🎨 The stored representation of a terminal color.
TermColorModeterm
🮖 🎨 The composition mode of one terminal color.
TermGridErrorterm
🮖 🗃️ 🚩 Terminal grid construction, access, and rendering error.
TermLineModeterm
🮖 🎮 How terminal input is delivered to an application.
TermPollPolicyterm
🮖 🎫 Terminal event polling policy.
TermelOccupancyterm
🮖 𝐓 🧱 ▫️ The cell-space occupancy represented by terminal-element metadata.
VarErrorstd
🚩 🖥️ std Returned from Env::var.
WebEventKindevent and web
🎫 🌐 🫆 A typed selector for web event names used by the web API browser bridge.
WebKeyLocationevent and web
🎮 🌐 Which part of the keyboard the key event originates from.
WebPermissionweb
🌐 A browser permission kind.
WebWorkerErrorweb
🌐 🚩 Errors that can occur when working with JavaScript Web Workers.
XErrorUnix and x11
🐚 🚩 XCB/X11 error categories.
XImageModeUnix and x11
🐚 Presentation backing policy for X11 image upload.

Traits§

AppEnvstd
🖥️ Manages directory paths in an environment-aware manner.
AsFdstd
📁 std A trait to borrow the file descriptor from an underlying object.
AsFdRawstd
📁 🫆 std A trait to extract the raw file descriptor from an underlying object.
BitSized
🫗 Type size information in bits.
Borrow
🍃 core A trait for borrowing data.
BorrowMut
🍃 core A trait for mutably borrowing data.
ByteSized
🫗 Type size information in bytes.
CellOptionExt
🫗 Extension trait providing additional methods for Cell<Option>.
DiagOut
🪵 Emits leveled diagnostic text.
FromFdRawstd
📁 🫆 💱 std Expresses the ability to construct an object from a raw file descriptor.
GlobalAllocalloc
🧺 alloc A memory allocator that can be registered as the standard library’s default.
IntoFdRawstd
📁 🫆 💱 std Expresses the ability to consume an object and own its raw file descriptor.
IoBufRead
🔌 ?std A type of Reader which has an internal buffer.
IoDuplex
🔌 A duplex byte I/O primitive.
IoRead
🔌 ?std Allows for reading bytes from a source.
IoSeek
🔌 ?std Provides a cursor which can be moved within a stream of bytes.
IoWrite
🔌 ?std A trait for objects which are byte-oriented sinks.
MemAligned
🫗 Marker trait to verify memory alignment between two types.
MemExt
🛠️ Extension trait for type memory information and manipulation.
MemPodunsafe_layout
🫗 Indicates a type is Plain Old Data, and meets specific memory layout guarantees.
Ownership
🍃 Defines the relationship between a borrowed type and its owned counterpart.
PathExtstd
📁 Extension trait providing additional methods for Path and PathBuf.
Sized
core Types with a constant size known at compile time.
SliceExt
🛠️ Extension trait providing additional methods for &[T].
SliceExtMut
🛠️ Extension trait providing additional methods for &mut [T].
Storage
🫗 Allows data structures to be generic over their storage strategy.
TermBackendterm
🮖 🖥️ Backend interface for terminal host adapters.
TextIn
🔌 𝐓 Reads UTF-8 text from an input surface into caller-provided storage.
TextOut
🔌 𝐓 Emits UTF-8 text to an output surface.
ToOwnedalloc
🫗 💱 alloc A generalization of Clone to borrowed data.
ToSocketAddrsstd
📡 std Objects which can be converted or resolved to one or more SocketAddr values.

Functions§

ansi_printlinux or std
🮖 🖥️ A function to print an ANSI escape sequence of bytes to stdout
fn_addr_eq
🫗 core Compares the addresses of the two function pointers for equality.
transmuteDeprecated
🫗 core Reinterprets the bits of a value of one type as another type.

Type Aliases§

Bare
🫗 core A zero-sized marker for a Storage type that wraps its data in a BareBox.
FdRaw
📁 🫆 Raw file descriptors.
IoResult
🔌 ⚖️ ?std A specialized Result type for I/O operations.
LINUX_SYSlinux
🐧 🖥️Linux sys/syscall.h constants for the current compilation target.
LinuxResultlinux
🐧 ⚖️ The return type for Linux-related functions that can fail.
MaybeByteunsafe_array
🤷 🫗 A byte type that may be uninitialized depending on features.

Unions§

MaybeUninit
🤷 🫗 core A wrapper type to construct uninitialized instances of T.