Module 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§

prelude
The Mycelium I/O Prelude

Structs§

Bytes
An iterator over u8 values of a reader.
Chain
Adaptor to chain together two readers.
Cursor
A Cursor wraps an in-memory buffer and provides it with a Seek implementation.
Empty
A reader which is always at EOF.
Error
The error type for I/O operations of the Read, Write, Seek, and associated traits.
Initializer
A type used to conditionally initialize buffers passed to Read methods.
Linesalloc
An iterator over the lines of an instance of BufRead.
Repeat
A reader which yields one byte over and over and over and over and over and…
Sink
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.
Take
Reader adaptor which limits the bytes read from an underlying reader.

Enums§

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

Traits§

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

Functions§

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

Type Aliases§

Result
A specialized Result type for I/O operations.