Struct libflate::gzip::EncodeOptions
source · pub struct EncodeOptions<E>where
E: Lz77Encode,{
header: Header,
options: EncodeOptions<E>,
}
Expand description
Options for a GZIP encoder.
Fields§
§header: Header
§options: EncodeOptions<E>
Implementations§
source§impl<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::gzip::{Encoder, EncodeOptions};
let options = EncodeOptions::with_lz77(DefaultLz77Encoder::new());
let encoder = Encoder::with_options(Vec::new(), options).unwrap();
sourcepub fn no_compression(self) -> Self
pub fn no_compression(self) -> Self
Disables LZ77 compression.
Example
use libflate::lz77::DefaultLz77Encoder;
use libflate::gzip::{Encoder, EncodeOptions};
let options = EncodeOptions::new().no_compression();
let encoder = Encoder::with_options(Vec::new(), options).unwrap();
sourcepub fn header(self, header: Header) -> Self
pub fn header(self, header: Header) -> Self
Sets the GZIP header which will be written to the output stream.
Example
use libflate::gzip::{Encoder, EncodeOptions, HeaderBuilder};
let header = HeaderBuilder::new().text().modification_time(100).finish();
let options = EncodeOptions::new().header(header);
let encoder = Encoder::with_options(Vec::new(), options).unwrap();
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 deflate::DEFAULT_BLOCK_SIZE
.
Example
use libflate::gzip::{Encoder, EncodeOptions};
let options = EncodeOptions::new().block_size(512 * 1024);
let encoder = Encoder::with_options(Vec::new(), options).unwrap();
sourcepub fn fixed_huffman_codes(self) -> Self
pub fn fixed_huffman_codes(self) -> Self
Specifies to compress with fixed huffman codes.
Example
use libflate::gzip::{Encoder, EncodeOptions};
let options = EncodeOptions::new().fixed_huffman_codes();
let encoder = Encoder::with_options(Vec::new(), options).unwrap();
Trait Implementations§
source§impl<E> Debug for EncodeOptions<E>where
E: Lz77Encode + Debug,
impl<E> Debug for EncodeOptions<E>where E: Lz77Encode + Debug,
source§impl Default for EncodeOptions<DefaultLz77Encoder>
impl Default for EncodeOptions<DefaultLz77Encoder>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more