Skip to content

Commit

Permalink
rust: Make tar writer capacity a const
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed Aug 21, 2024
1 parent 8eb8775 commit 229670a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/dekoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub struct EKO {

/// Operators directory.
const DIR_OPERATORS: &str = "operators/";
/// Buffer capacity for tar writer
const TAR_WRITER_CAPACITY: usize = 128 * 1024;

impl EKO {
/// Check our working directory is safe.
Expand Down Expand Up @@ -119,7 +121,7 @@ impl EKO {
self.assert_working_dir()?;
// create writer
let dst_file = File::create(&dst)?;
let dst_file = BufWriter::with_capacity(128 * 1024, dst_file);
let dst_file = BufWriter::with_capacity(TAR_WRITER_CAPACITY, dst_file);
let mut ar = tar::Builder::new(dst_file);
// do it!
Ok(ar.append_dir_all(".", &self.path)?)
Expand Down

0 comments on commit 229670a

Please sign in to comment.