Crate portable_io

Source
Expand description

Traits, helpers, and type definitions for core I/O functionality. A subset from Rust std::io functionality supported for no-std.

MSRV:

  • stable: 1.81.0
  • nightly: nightly-2022-08-24

NOTE: unstable configuration --cfg portable_io_unstable_all in Rust flags is required for Rust nightly pre-2024-06-09 to enable error_in_core feature directive (stabilized in June 2024).

§Features

  • alloc (enabled by default) - mandatory feature - for alloc-related functionality
  • os-error (unstable feature) - support raw OS errors - with some KNOWN PANICS due to MISSING FUNCTIONALITY
  • unix-iovec (unstable feature) - use iovec from libc for data stored in IoSlice & IoSliceMut

§CFG options

  • portable_io_unstable_all - enable all unstable option(s):
    • size hint optimization for Read iterator - uses Rust unstable min_specialization feature

To enable: use --cfg portable_io_unstable_all in Rust flags, set RUSTFLAGS env variable when running cargo build or cargo test for example.

Modules§

prelude
The I/O Prelude.

Structs§

Bytes
An iterator over u8 values of a reader.
Chain
Adapter to chain together two readers.
Cursor
A Cursor wraps an in-memory buffer and provides it with a Seek implementation.
Error
The error type for I/O operations of the Read, Write, Seek, and associated traits.
IoSlice
A buffer type used with Write::write_vectored.
IoSliceMut
A buffer type used with Read::read_vectored.
Lines
An iterator over the lines of an instance of BufRead.
ReadBuf
A wrapper around a byte buffer that is incrementally filled and initialized.
Split
An iterator over the contents of an instance of BufRead split on a particular byte.
Take
Reader adapter 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§

read_to_string
Read all bytes from a reader into a new String.

Type Aliases§

Result
A specialized Result type for I/O operations.