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_endandRead::read_to_stringrequire the “alloc” feature flag onmycelium_util(which is enabled by default). Bootloaders & other code which cannot allocate may disable this feature flag.Read::read_vectoredandWrite::write_vectoreddo not exist.- Most of the
BufReadutility functions (lines,split,read_until) require the “alloc” feature BufReaderandBufWriterrequire the “alloc” feature (and are not yet implemented).- The
io::Errortype takes anErrorKindand 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
u8values of a reader. - Chain
- Adaptor to chain together two readers.
- Cursor
- A
Cursorwraps an in-memory buffer and provides it with aSeekimplementation. - 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
Readmethods. - Lines
alloc - 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.
- Split
alloc - An iterator over the contents of an instance of
BufReadsplit on a particular byte. - Take
- Reader adaptor which limits the bytes read from an underlying reader.
Enums§
- Error
Kind - A list specifying general categories of I/O error.
- Seek
From - Enumeration of possible methods to seek within an I/O object.
Traits§
- BufRead
- A
BufReadis a type ofReader which has an internal buffer, allowing it to perform extra ways of reading. - Read
- The
Readtrait allows for reading bytes from a source. - Seek
- The
Seektrait 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.