Skip to main content

StreamCompressor

Struct StreamCompressor 

Source
pub struct StreamCompressor { /* private fields */ }
Expand description

A handle to the streaming compressor.

Implementations§

Source§

impl StreamCompressor

Source

pub fn sender(&self) -> &Sender<ArchiveEntry>

Examples found in repository?
examples/bench_stream.rs (line 58)
53fn run_once(kind: &str, entries: Vec<ArchiveEntry>, archive: &std::path::PathBuf) -> (f64, u64, u64) {
54    let input_bytes: u64 = entries.iter().map(|e| e.data.len() as u64).sum();
55    let t0 = Instant::now();
56    let compressor = compress_stream(archive, false).expect("compress_stream");
57    for e in entries {
58        compressor.sender().send(e).expect("send");
59    }
60    let report = compressor.finish().expect("finish");
61    let secs = t0.elapsed().as_secs_f64();
62    let _ = kind;
63    (secs, input_bytes, report.chunks)
64}
Source

pub fn finish(self) -> Result<CompressionReport>

Examples found in repository?
examples/bench_stream.rs (line 60)
53fn run_once(kind: &str, entries: Vec<ArchiveEntry>, archive: &std::path::PathBuf) -> (f64, u64, u64) {
54    let input_bytes: u64 = entries.iter().map(|e| e.data.len() as u64).sum();
55    let t0 = Instant::now();
56    let compressor = compress_stream(archive, false).expect("compress_stream");
57    for e in entries {
58        compressor.sender().send(e).expect("send");
59    }
60    let report = compressor.finish().expect("finish");
61    let secs = t0.elapsed().as_secs_f64();
62    let _ = kind;
63    (secs, input_bytes, report.chunks)
64}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.