Expand description
ax-io
`std::io` for `no_std` environment
English | 中文
§Introduction
ax-io provides std::io for no_std environment. It is maintained as part of the TGOSKits component set and is intended for Rust projects that integrate with ArceOS, AxVisor, or related low-level systems software.
ax-io was derived from https://github.com/arceos-org/axio
§Quick Start
§Installation
Add this crate to your Cargo.toml:
[dependencies]
ax-io = "0.5.0"§Run Check and Test
# Enter the crate directory
cd components/axio
# Format code
cargo fmt --all
# Run clippy
cargo clippy --all-targets --all-features
# Run tests
cargo test --all-features
# Build documentation
cargo doc --no-deps§Integration
§Example
use ax_io as _;
fn main() {
// Integrate `ax-io` into your project here.
}§Documentation
Generate and view API documentation:
cargo doc --no-deps --openOnline documentation: docs.rs/ax-io
§Contributing
- Fork the repository and create a branch
- Run local format and checks
- Run local tests relevant to this crate
- Submit a PR and ensure CI passes
§License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Re-exports§
pub use ax_errno::AxError as Error;pub use ax_errno::AxErrorKind as ErrorKind;pub use ax_errno::AxResult as Result;
Modules§
- prelude
- The I/O Prelude.
Structs§
- BufReader
- The
BufReader<R>struct adds buffering to any reader. - BufWriter
- Wraps a writer and buffers its output.
- Chain
- Adapter to chain together two readers.
- Cursor
- A
Cursorwraps an in-memory buffer and provides it with aSeekimplementation. - Empty
Emptyignores any data written viaWrite, and will always be empty (returning zero bytes) when read viaRead.- Into
Inner Error - An error returned by
BufWriter::into_innerwhich combines an error that happened while writing out the buffer, and the buffered writer object which may be used to recover from the condition. - Line
Writer - The
BufWriterstruct wraps a writer and buffers its output. But it only does this batched write when it goes out of scope, or when the internal buffer is full. Sometimes, you’d prefer to write each line as it’s completed, rather than the entire buffer at once. EnterLineWriter. It does exactly that. - Poll
State - I/O poll results.
- ReadFn
- Reader created by
read_fn. - 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.
- Take
- Reader adapter which limits the bytes read from an underlying reader.
- WriteFn
- Writer created by
write_fn. - Writer
Panicked - Error returned for the buffered data from
BufWriter::into_parts, when the underlying writer has previously panicked. Contains the (possibly partly written) buffered data.
Enums§
- Seek
From - Enumeration of possible methods to seek within an I/O object.
Constants§
- DEFAULT_
BUF_ SIZE - Default buffer size for I/O operations.
Traits§
- BufRead
- A
BufReadis a type ofReader which has an internal buffer, allowing it to perform extra ways of reading. - IoBuf
- A trait for byte buffers that can be used as a source of bytes to read.
- IoBuf
Ext - Extension methods for
IoBuf. - IoBuf
Mut - A trait for byte buffers that can be used as a destination for bytes to write.
- IoBuf
MutExt - Extension methods for
IoBufMut. - 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.
- default_
read_ buf - Default
Read::read_bufimplementation. - default_
read_ buf_ exact - Default
Read::read_buf_exactimplementation. - default_
read_ exact - Default
Read::read_exactimplementation. - default_
stream_ len - Default
Seek::stream_lenimplementation. - empty
- Creates a value that is always at EOF for reads, and ignores all data written.
- read_fn
- Creates a reader that wraps a function.
- 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.
- stack_
buffer_ copy - Fallback
copyimplementation using a stack-allocated buffer. - write_
fn - Creates a writer that wraps a function.