Skip to content

Commit

Permalink
Merge pull request #73 from SnowflakePowered/patch-detach-decoder-lif…
Browse files Browse the repository at this point in the history
…etimes

Detach lifetime of output buffer from DecoderState
  • Loading branch information
gendx authored Jun 9, 2022
2 parents bd52df4 + 163b034 commit 4131dd3
Show file tree
Hide file tree
Showing 8 changed files with 197 additions and 215 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- stable
- beta
- nightly
- 1.40.0 # MSRV
- 1.50.0 # MSRV
fail-fast: false
runs-on: ${{ matrix.os }}
env:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Documentation](https://docs.rs/lzma-rs/badge.svg)](https://docs.rs/lzma-rs)
[![Safety Dance](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)
![Build Status](https://github.com/gendx/lzma-rs/workflows/Build%20and%20run%20tests/badge.svg)
[![Minimum rust 1.40](https://img.shields.io/badge/rust-1.40%2B-orange.svg)](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1400-2019-12-19)
[![Minimum rust 1.50](https://img.shields.io/badge/rust-1.50%2B-orange.svg)](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1500-2021-02-11)

This project is a decoder for LZMA and its variants written in pure Rust, with focus on clarity.
It already supports LZMA, LZMA2 and a subset of the `.xz` file format.
Expand Down
8 changes: 2 additions & 6 deletions src/decode/lzbuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ impl<W> LzAccumBuffer<W>
where
W: io::Write,
{
pub fn from_stream(stream: W) -> Self {
Self::from_stream_with_memlimit(stream, std::usize::MAX)
}

pub fn from_stream_with_memlimit(stream: W, memlimit: usize) -> Self {
pub fn from_stream(stream: W, memlimit: usize) -> Self {
Self {
stream,
buf: Vec::new(),
Expand Down Expand Up @@ -175,7 +171,7 @@ impl<W> LzCircularBuffer<W>
where
W: io::Write,
{
pub fn from_stream_with_memlimit(stream: W, dict_size: usize, memlimit: usize) -> Self {
pub fn from_stream(stream: W, dict_size: usize, memlimit: usize) -> Self {
lzma_info!("Dict size in LZ buffer: {}", dict_size);
Self {
stream,
Expand Down
Loading

0 comments on commit 4131dd3

Please sign in to comment.