- Updated dependencies
- Updated docs
- Updated dependencies
- Added comments about the costly conversion in `TryFrom'
- Resolved issue with byte mode in
FileIter
. It now correctly handles chunk sizes.
- Implemented
TryFrom
for FileIter
with support for various input types:
File
--> FileIter
BufReader<File>
--> FileIter
Vec<u8>
--> FileIter
&Vec<u8>
--> FileIter
io::Cursor<Vec<u8>>
--> FileIter
BufReader<io::Cursor<Vec<u8>>>
--> FileIter
&[u8]
--> FileIter
&str
--> FileIter
(equivalent to the new
method)
String
--> FileIter
(equivalent to the new
method)
Cow<'_, str>
--> FileIter
(equivalent to the new
method)
use get_chunk::iterator::FileIter;
use std::{fs::File, io};
fn main() -> io::Result<()> {
let file = FileIter::try_from(File::open("src/main.rs")?)?;
for chunk in file {
// ...
}
Ok(())
}
- Implemented
TryFrom
for FileStream
with custom trait to support async operations (use the try_from_data
method instead of try_from
):
File
--> FileIter
BufReader<File>
--> FileIter
Vec<u8>
--> FileIter
io::Cursor<Vec<u8>>
--> FileIter
BufReader<io::Cursor<Vec<u8>>>
--> FileIter
String
--> FileIter
(equivalent to the new
method)
use get_chunk::stream::{FileStream, StreamExt, TryFrom};
use tokio::{fs::File, io};
#[tokio::main]
async fn main() -> io::Result<()> {
let mut file = FileStream::try_from_data(File::open("src/main.rs").await?).await?;
while let Some(chunk) = file.next().await {
// ...
}
Ok(())
}
- Fixed method for setting the start position of
stream
(set_start_position).
- Added fields to
Cargo.toml
to build documentation with all features
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
- Added
include_available_swap
method to include free swap partition/file in the calculation
- Now when creating iterator/stream, only free RAM is considered by default.
- Introducing the first stable release of the library.
- Improved and stabilized the API compared to previous versions.
- Implemented new enums and units for both SI and IEC data size representations.
- Introduced the concept of adaptive chunk size adjustment based on the performance of the file reading process.
- Added functions for creating and working with data size units.
- Added support for iterators and streams to enhance data processing capabilities.