Module mycelium_util::io

source ·
Expand description

A modified version of the Rust standard library’s std::io module, suitable for use in Mycelium and other kernels.

The traits and functions here are mostly identical to (and copied from!) the standard library’s std::io module, with the following differences:

  • Read::read_to_end and Read::read_to_string require the “alloc” feature flag on mycelium_util (which is enabled by default). Bootloaders & other code which cannot allocate may disable this feature flag.
  • Read::read_vectored and Write::write_vectored do not exist.
  • Most of the BufRead utility functions (lines, split, read_until) require the “alloc” feature
  • BufReader and BufWriter require the “alloc” feature (and are not yet implemented).
  • The io::Error type takes an ErrorKind and an optional &'static str, and does not wrap another error. This is because we need to be able to construct I/O errors even when we cannot allocate.

Modules

Structs

  • An iterator over u8 values of a reader.
  • Adaptor to chain together two readers.
  • A Cursor wraps an in-memory buffer and provides it with a Seek implementation.
  • A reader which is always at EOF.
  • The error type for I/O operations of the Read, Write, Seek, and associated traits.
  • A type used to conditionally initialize buffers passed to Read methods.
  • Linesalloc
    An iterator over the lines of an instance of BufRead.
  • A reader which yields one byte over and over and over and over and over and…
  • A writer which will move data into the void.
  • Splitalloc
    An iterator over the contents of an instance of BufRead split on a particular byte.
  • Reader adaptor which limits the bytes read from an underlying reader.

Enums

  • A list specifying general categories of I/O error.
  • Enumeration of possible methods to seek within an I/O object.

Traits

  • A BufRead is a type of Reader which has an internal buffer, allowing it to perform extra ways of reading.
  • The Read trait allows for reading bytes from a source.
  • The Seek trait provides a cursor which can be moved within a stream of bytes.
  • A trait for objects which are byte-oriented sinks.

Functions

  • Copies the entire contents of a reader into a writer.
  • Constructs a new handle to an empty reader.
  • Creates an instance of a reader that infinitely repeats one byte.
  • Creates an instance of a writer which will successfully consume all data.

Type Aliases