-
Notifications
You must be signed in to change notification settings - Fork 6
refactor: project structure, enhance basic traits #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the first stage of refactoring for the axio crate, reorganizing the project structure and expanding functionality to better align with std::io.
Key Changes:
- Reorganized code by splitting traits into separate modules (
read,write,seek) with dedicated implementation files - Added new trait methods including
Read::read_buf,Read::read_buf_exact,BufRead::skip_until,BufRead::split,BufRead::lines,Seek::stream_len, andSeek::seek_relative - Integrated
memchrcrate for optimized byte searching inBufRead::read_untilandBufRead::skip_until
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Cargo.toml | Updated edition to 2024, bumped axerrno dependency to 0.2, added memchr dependency |
| README.md | Enhanced documentation with feature descriptions, differences from std::io, limitations, and license information |
| src/lib.rs | Refactored to use module-based organization, added DEFAULT_BUF_SIZE constant, re-exported types from axerrno |
| src/prelude.rs | Updated documentation example and import path to use crate:: instead of super:: |
| src/write/mod.rs | New module defining Write trait with write, flush, write_all, write_fmt, and by_ref methods |
| src/write/impls.rs | Implementations of Write trait for references, Box, byte slices, Vec, VecDeque, and BorrowedCursor |
| src/seek/mod.rs | New module defining Seek trait and SeekFrom enum with additional methods stream_len and seek_relative |
| src/seek/impls.rs | Forwarding implementations of Seek trait for references and Box |
| src/read/mod.rs | New module defining Read and BufRead traits with expanded functionality, including Split and Lines iterators |
| src/read/impls.rs | Comprehensive implementations of Read and BufRead for various types including slices, Box, VecDeque |
| src/error.rs | Deleted - functionality moved to lib.rs via re-exports from axerrno |
| src/impls.rs | Deleted - implementations reorganized into module-specific impls.rs files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4798067 to
023849d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
The value of In // Bare metal platforms usually have very small amounts of RAM
// (in the order of hundreds of KB)
pub const DEFAULT_BUF_SIZE: usize = if cfg!(target_os = "espidf") { 512 } else { 8 * 1024 };
|
Can we support different size via feature like https://github.com/arceos-org/arceos/blob/main/modules/axalloc/Cargo.toml#L17-L18? Because we may be used at different platforms. |
That sounds reasonable. But now we need to select a suitable set of default buffer sizes. |
|
Oh, now there's a problem. Should we silently ignore |
This is the first stage of refactoring, extracted from #4.
Changes
Read::read_buf/Read::read_buf_exact/Read::by_refBufRead::skip_until/BufRead::split/BufRead::linesSeek::stream_len/Seek::seek_relativememchrto optimizeBufRead::read_until(also used inBufRead::skip_until)