pub struct EncodeOptions<E = DefaultLz77Encoder> {
block_size: usize,
dynamic_huffman: bool,
lz77: Option<E>,
}
Expand description
Options for a DEFLATE encoder.
Fields
block_size: usize
dynamic_huffman: bool
lz77: Option<E>
Implementations
sourceimpl<E> EncodeOptions<E> where
E: Lz77Encode,
impl<E> EncodeOptions<E> where
E: Lz77Encode,
sourcepub fn with_lz77(lz77: E) -> Self
pub fn with_lz77(lz77: E) -> Self
Specifies the LZ77 encoder used to compress input data.
Example
use libflate::lz77::DefaultLz77Encoder;
use libflate::deflate::{Encoder, EncodeOptions};
let options = EncodeOptions::with_lz77(DefaultLz77Encoder::new());
let encoder = Encoder::with_options(Vec::new(), options);
sourcepub fn no_compression(self) -> Self
pub fn no_compression(self) -> Self
Disables LZ77 compression.
Example
use libflate::lz77::DefaultLz77Encoder;
use libflate::deflate::{Encoder, EncodeOptions};
let options = EncodeOptions::new().no_compression();
let encoder = Encoder::with_options(Vec::new(), options);
sourcepub fn block_size(self, size: usize) -> Self
pub fn block_size(self, size: usize) -> Self
Specifies the hint of the size of a DEFLATE block.
The default value is DEFAULT_BLOCK_SIZE
.
Example
use libflate::deflate::{Encoder, EncodeOptions};
let options = EncodeOptions::new().block_size(512 * 1024);
let encoder = Encoder::with_options(Vec::new(), options);
sourcepub fn fixed_huffman_codes(self) -> Self
pub fn fixed_huffman_codes(self) -> Self
Specifies to compress with fixed huffman codes.
Example
use libflate::deflate::{Encoder, EncodeOptions};
let options = EncodeOptions::new().fixed_huffman_codes();
let encoder = Encoder::with_options(Vec::new(), options);
fn get_block_type(&self) -> BlockType
fn get_block_size(&self) -> usize
Trait Implementations
sourceimpl<E: Clone> Clone for EncodeOptions<E>
impl<E: Clone> Clone for EncodeOptions<E>
sourcefn clone(&self) -> EncodeOptions<E>
fn clone(&self) -> EncodeOptions<E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<E: Debug> Debug for EncodeOptions<E>
impl<E: Debug> Debug for EncodeOptions<E>
sourceimpl Default for EncodeOptions<DefaultLz77Encoder>
impl Default for EncodeOptions<DefaultLz77Encoder>
sourceimpl<E: Hash> Hash for EncodeOptions<E>
impl<E: Hash> Hash for EncodeOptions<E>
sourceimpl<E: PartialEq> PartialEq<EncodeOptions<E>> for EncodeOptions<E>
impl<E: PartialEq> PartialEq<EncodeOptions<E>> for EncodeOptions<E>
sourcefn eq(&self, other: &EncodeOptions<E>) -> bool
fn eq(&self, other: &EncodeOptions<E>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &EncodeOptions<E>) -> bool
fn ne(&self, other: &EncodeOptions<E>) -> bool
This method tests for !=
.
impl<E: Eq> Eq for EncodeOptions<E>
impl<E> StructuralEq for EncodeOptions<E>
impl<E> StructuralPartialEq for EncodeOptions<E>
Auto Trait Implementations
impl<E> RefUnwindSafe for EncodeOptions<E> where
E: RefUnwindSafe,
impl<E> Send for EncodeOptions<E> where
E: Send,
impl<E> Sync for EncodeOptions<E> where
E: Sync,
impl<E> Unpin for EncodeOptions<E> where
E: Unpin,
impl<E> UnwindSafe for EncodeOptions<E> where
E: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more