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
andRead::read_to_string
require the “alloc” feature flag onmycelium_util
(which is enabled by default). Bootloaders & other code which cannot allocate may disable this feature flag.Read::read_vectored
andWrite::write_vectored
do not exist.- Most of the
BufRead
utility functions (lines
,split
,read_until
) require the “alloc” feature BufReader
andBufWriter
require the “alloc” feature (and are not yet implemented).- The
io::Error
type takes anErrorKind
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
- The Mycelium I/O Prelude
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 aSeek
implementation. - A reader which is always at EOF.
- A type used to conditionally initialize buffers passed to
Read
methods. - Lines
alloc
An iterator over the lines of an instance ofBufRead
. - 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.
- Split
alloc
An iterator over the contents of an instance ofBufRead
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 ofRead
er 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
- A specialized
Result
type for I/O operations.