Skip to content
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

Renamed uncompress_file function to uncompress_data #17

Merged
merged 1 commit into from
Apr 17, 2020
Merged
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
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Added

* `uncompress_file` and `uncompress_archive_file`, on success, now return the ammount of bytes they have uncompressed [#16]
* `uncompress_data` (previously `uncompress_file`) and `uncompress_archive_file`, on success, now return the ammount of bytes they have uncompressed [#16]

[#16]: https://github.com/OSSystems/compress-tools-rs/pull/16

Expand All @@ -14,7 +14,10 @@
* `Read` and `Write` arguments are no longer required to be a mutable reference,
which allows for more tyes to be used, as `&mut [u8]`

* Renamed `uncompress_file` function to `uncompress_data` [#17]

[#14]: https://github.com/OSSystems/compress-tools-rs/pull/14
[#17]: https://github.com/OSSystems/compress-tools-rs/pull/17

## [0.3.1] 2020-04-14

Expand Down
2 changes: 1 addition & 1 deletion examples/uncompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn main() -> compress_tools::Result<()> {
let mut source = std::fs::File::open(input.source_path)?;
let mut target = std::fs::File::open(input.target_path)?;

uncompress_file(&mut source, &mut target)?;
uncompress_data(&mut source, &mut target)?;
}
CmdLine::UncompressArchiveFile(input) => {
let mut source = std::fs::File::open(input.source_path)?;
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ enum Mode {
/// let mut source = File::open("file.txt.gz")?;
/// let mut target = Vec::default();
///
/// uncompress_file(&mut source, &mut target)?;
/// uncompress_data(&mut source, &mut target)?;
/// # Ok(())
/// # }
/// ```
Expand All @@ -90,11 +90,11 @@ enum Mode {
/// let mut source = File::open("file.txt.gz")?;
/// let mut target = [0 as u8;313];
///
/// uncompress_file(&mut source, &mut target as &mut [u8])?;
/// uncompress_data(&mut source, &mut target as &mut [u8])?;
/// # Ok(())
/// # }
/// ```
pub fn uncompress_file<R, W>(source: R, target: W) -> Result<usize>
pub fn uncompress_data<R, W>(source: R, target: W) -> Result<usize>
where
R: Read,
W: Write,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn get_compressed_file_content() {
let mut source = std::fs::File::open("tests/fixtures/file.txt.gz").unwrap();
let mut target = Vec::default();

let written = uncompress_file(&mut source, &mut target).expect("Failed to uncompress the file");
let written = uncompress_data(&mut source, &mut target).expect("Failed to uncompress the file");
assert_eq!(
String::from_utf8_lossy(&target),
"some_file_content\n",
Expand Down