Skip to main content

Crate ax_io

Crate ax_io 

Source
Expand description

ax-io

`std::io` for `no_std` environment

Crates.io Docs.rs Rust License

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 --open

Online documentation: docs.rs/ax-io

§Contributing

  1. Fork the repository and create a branch
  2. Run local format and checks
  3. Run local tests relevant to this crate
  4. 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 Cursor wraps an in-memory buffer and provides it with a Seek implementation.
Empty
Empty ignores any data written via Write, and will always be empty (returning zero bytes) when read via Read.
IntoInnerError
An error returned by BufWriter::into_inner which combines an error that happened while writing out the buffer, and the buffered writer object which may be used to recover from the condition.
LineWriter
The BufWriter struct 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. Enter LineWriter. It does exactly that.
PollState
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.
WriterPanicked
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§

SeekFrom
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 BufRead is a type of Reader 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.
IoBufExt
Extension methods for IoBuf.
IoBufMut
A trait for byte buffers that can be used as a destination for bytes to write.
IoBufMutExt
Extension methods for IoBufMut.
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.
default_read_buf
Default Read::read_buf implementation.
default_read_buf_exact
Default Read::read_buf_exact implementation.
default_read_exact
Default Read::read_exact implementation.
default_stream_len
Default Seek::stream_len implementation.
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 copy implementation using a stack-allocated buffer.
write_fn
Creates a writer that wraps a function.