diff --git a/Cargo.toml b/Cargo.toml index 16a57267..d899ebd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ bitvec = { version = "1.0.1", features = ["atomic"] } num_cpus = "1.15.0" epserde = "0.2.0" sux = "0.1" -dsi-bitstream = "0.1.0" +dsi-bitstream = "0.1.2" # Bin dependancies clap = { version = "4.1.6", features = ["derive"] } dsi-progress-logger = "0.2.0" diff --git a/src/graph/bvgraph/bvgraph_codes.rs b/src/graph/bvgraph/bvgraph_codes.rs index ff62f4d4..662f613c 100644 --- a/src/graph/bvgraph/bvgraph_codes.rs +++ b/src/graph/bvgraph/bvgraph_codes.rs @@ -122,5 +122,5 @@ pub trait BVGraphCodesWriter { fn write_residual(&mut self, value: u64) -> Result; /// Consume the writer and call flush on the underlying writer - fn flush(self) -> Result<(), Self::Error>; + fn flush(&mut self) -> Result<(), Self::Error>; } diff --git a/src/graph/bvgraph/bvgraph_writer.rs b/src/graph/bvgraph/bvgraph_writer.rs index b376d733..2d14f66f 100644 --- a/src/graph/bvgraph/bvgraph_writer.rs +++ b/src/graph/bvgraph/bvgraph_writer.rs @@ -451,7 +451,7 @@ impl BVComp { } /// Consume the compressor and flush the inner writer. - pub fn flush(self) -> Result<(), WGCW::Error> { + pub fn flush(&mut self) -> Result<(), WGCW::Error> { self.bit_write.flush() } } @@ -651,6 +651,7 @@ mod test { bvcomp.extend(&seq_graph).unwrap(); bvcomp.flush()?; + drop(bvcomp); // Read it back let buffer_32: &[u32] = unsafe { buffer.align_to().1 }; diff --git a/src/graph/bvgraph/code_readers.rs b/src/graph/bvgraph/code_readers.rs index a23eb4e6..2c8d4be1 100644 --- a/src/graph/bvgraph/code_readers.rs +++ b/src/graph/bvgraph/code_readers.rs @@ -386,7 +386,7 @@ where select_code_write!(self, RESIDUALS, K, value) } - fn flush(self) -> Result<(), Self::Error> { + fn flush(&mut self) -> Result<(), Self::Error> { self.code_writer.flush() } } @@ -489,7 +489,7 @@ impl< select_code_mock_write!(RESIDUALS, K, value) } - fn flush(self) -> Result<(), Self::Error> { + fn flush(&mut self) -> Result<(), Self::Error> { Ok(()) } } diff --git a/src/graph/bvgraph/dyn_bv_code_readers.rs b/src/graph/bvgraph/dyn_bv_code_readers.rs index 2956cc23..b5ba7208 100644 --- a/src/graph/bvgraph/dyn_bv_code_readers.rs +++ b/src/graph/bvgraph/dyn_bv_code_readers.rs @@ -500,7 +500,7 @@ where (self.write_residual)(&mut self.code_writer, value) } - fn flush(self) -> Result<(), Self::Error> { + fn flush(&mut self) -> Result<(), Self::Error> { self.code_writer.flush() } } @@ -600,7 +600,7 @@ impl BVGraphCodesWriter for DynamicCodesMockWriter { Ok((self.len_residual)(value)) } - fn flush(self) -> Result<(), Self::Error> { + fn flush(&mut self) -> Result<(), Self::Error> { Ok(()) } }