Crate base

source ·
Expand description

Safe, cross-platform-compatible wrappers for system interfaces.

Re-exports§

Modules§

Macros§

  • Logs a message at the debug level.
  • Logs a message at the error level.
  • Macro that retries the given expression every time its result indicates it was interrupted (i.e. returned EINTR). This is useful for operations that are prone to being interrupted by signals, such as blocking syscalls.
  • Macro that retries the given expression every time its result indicates it was interrupted. It is intended to use with system functions that signal error by returning -1 and setting errno to appropriate error code (EINTR, EINVAL, etc.) Most of standard non-reentrant libc functions use this way of signalling errors.
  • Macro that retries the given expression every time its result indicates it was interrupted. It is intended to use with system functions that return EINTR and other error codes directly as their result. Most of reentrant functions use this way of signalling errors.
  • Logs a message at the info level.
  • Raw macro to declare the expression that calculates an ioctl number
  • Declare an ioctl that transfers no data.
  • Raw macro to declare a constant or a function that returns an ioctl number.
  • Declare an ioctl that reads data.
  • Declare an ioctl that writes data.
  • Declare an ioctl that reads and writes data.
  • Assert repeatedly until it’s true
  • Logs a message at the trace level.
  • Logs a message at the warn level.

Structs§

  • A system error In Unix systems, retrieved from errno (man 3 errno), set by a libc function that returned an error. On Windows, retrieved from GetLastError, set by a Windows function that returned an error
  • An inter-process event wait/notify mechanism. Loosely speaking: Writes signal the event. Reads block until the event is signaled and then clear the signal.
  • A fake clock that can be used in tests to give exact control over the time. For a code example, see the tests in base/src/timer.rs.
  • FakeTimer: For use in tests.
  • Cross-platform mutable buffer.
  • A contiguous memory allocation with a specified size and alignment, with a Drop impl to perform the deallocation.
  • See MemoryMapping for struct- and method-level documentation.
  • Memory access type for anonymous shared memory mapping.
  • A Tube end which can only recv messages.
  • A Tube end which can only send messages. Cloneable.
  • A shared memory file descriptor and its size.
  • Represents an event that has been signaled and waited for via a wait function.
  • A slice of raw memory that supports volatile access. Like std::io::IoSliceMut, this type is guaranteed to be ABI-compatible with libc::iovec but unlike IoSliceMut, it doesn’t automatically deref to &mut [u8].
  • Used to wait for multiple objects which are eligible for waiting.
  • Wrapper object for creating a worker thread that can be stopped by signaling an event.

Enums§

Traits§

  • An empty trait that helps reset timer resolution to its previous state.
  • Trait that can be used to associate events with arbitrary enums when using WaitContext.
  • A trait for allocating disk space in a sparse file. This is equivalent to fallocate() with no special flags.
  • A trait for getting the size of a file. This is equivalent to File’s metadata().len() method, but wrapped in a trait so that it can be implemented for other types.
  • A trait similar to the unix ReadExt and WriteExt traits, but for volatile memory.
  • A trait similar to Read and Write, but uses volatile memory as buffers.
  • A trait for setting the size of a file. This is equivalent to File’s set_len method, but wrapped in a trait so that it can be implemented for other types.
  • A trait for flushing the contents of a file to disk. This is equivalent to File’s sync_all and sync_data methods, but wrapped in a trait so that it can be implemented for other types.
  • A range of memory that can be msynced, for abstracting over different types of memory mappings.
  • A trait for deallocating space in a file.
  • A trait for timer objects that delivers timer expiration notifications to an underlying descriptor.
  • Trait for types that support raw volatile access to their data.
  • A trait for writing zeroes to an arbitrary position in a file.

Functions§

Type Aliases§

Derive Macros§

  • Implements the EventToken trait for a given enum.