Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
matrix:
rust-toolchain:
- nightly
- nightly-2025-05-20
- nightly-2025-12-12
- stable
env:
Expand Down
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "axio"
version = "0.2.1"
edition = "2021"
edition = "2024"
authors = ["Yuekai Jia <[email protected]>"]
description = "`std::io`-like I/O traits for `no_std` environment"
description = "`std::io` for `no_std` environment"
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0"
homepage = "https://github.com/arceos-org/arceos"
repository = "https://github.com/arceos-org/axio"
Expand All @@ -16,7 +16,9 @@ alloc = []
default = []

[dependencies]
axerrno = "0.1"
axerrno = "0.2"
heapless = "0.9"
memchr = { version = "2", default-features = false }

[build-dependencies]
autocfg = "1"
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@
[![Docs.rs](https://docs.rs/axio/badge.svg)](https://docs.rs/axio)
[![CI](https://github.com/arceos-org/axio/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/arceos-org/axio/actions/workflows/ci.yml)

[`std::io`][1]-like I/O traits for `no_std` environment.
[`std::io`][1] for `no_std` environment.

[1]: https://doc.rust-lang.org/std/io/index.html

### Features

- **alloc**:
- Enables extra methods on `Read`: `read_to_end`, `read_to_string`.
- Enables extra methods on `BufRead`: `read_until`, `read_line`, `split`, `lines`.
- Enables implementations of axio traits for `alloc` types like `Vec<u8>`, `Box<T>`, etc.
- Enables `BufWriter::with_capacity`. (If `alloc` is disabled, only `BufWriter::new` is available.)
- Removes the capacity limit on `BufReader`. (If `alloc` is disabled, `BufReader::with_capacity` will panic if the capacity is larger than a fixed limit.)

### Differences to `std::io`

- Error types from `axerrno` instead of `std::io::Error`.
- No `IoSlice` and `*_vectored` APIs.

### Limitations

- Requires nightly Rust.

## License

Licensed under either of

- GNU General Public License v3.0 or later, (<https://www.gnu.org/licenses/gpl-3.0.html>)
- Apache License, Version 2.0, (<https://www.apache.org/licenses/LICENSE-2.0>)
- Mulan Permissive Software License, Version 2, (<https://license.coscl.org.cn/MulanPSL2>)

at your option.

---

Almost all of the code in this repository is a copy of the [Rust language codebase](https://github.com/rust-lang/rust) with minor modifications.

For attributions, see <https://thanks.rust-lang.org/>.
14 changes: 13 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
fn main() {
autocfg::emit_possibility("borrowedbuf_init");
autocfg::rerun_path("build.rs");

let ac = autocfg::new();

autocfg::emit_possibility("borrowedbuf_init");
let code = r#"
#![no_std]
#![feature(core_io_borrowed_buf)]
Expand All @@ -13,4 +14,15 @@ fn main() {
if ac.probe_raw(code).is_ok() {
autocfg::emit("borrowedbuf_init");
}

autocfg::emit_possibility("maybe_uninit_slice");
let code = r#"
#![no_std]
pub fn probe() {
let _ = <[core::mem::MaybeUninit<()>]>::assume_init_mut;
}
"#;
if ac.probe_raw(code).is_ok() {
autocfg::emit("maybe_uninit_slice");
}
}
18 changes: 18 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
unstable_features = true

style_edition = "2024"

group_imports = "StdExternalCrate"
imports_granularity = "Crate"

normalize_comments = true
wrap_comments = true
comment_width = 100

condense_wildcard_suffixes = true
enum_discrim_align_threshold = 20
use_field_init_shorthand = true

format_strings = true
format_code_in_doc_comments = true
format_macro_matchers = true
158 changes: 0 additions & 158 deletions src/buffered/bufreader.rs

This file was deleted.

Loading