Struct libflate::gzip::HeaderBuilder [−][src]
GZIP header builder.
Implementations
impl HeaderBuilder
[src]
pub fn new() -> Self
[src]
Makes a new builder instance.
Examples
use libflate::gzip::{HeaderBuilder, CompressionLevel, Os}; let header = HeaderBuilder::new().finish(); assert_eq!(header.compression_level(), CompressionLevel::Unknown); assert_eq!(header.os(), Os::Unix); assert_eq!(header.is_text(), false); assert_eq!(header.is_verified(), false); assert_eq!(header.extra_field(), None); assert_eq!(header.filename(), None); assert_eq!(header.comment(), None);
pub fn modification_time(&mut self, modification_time: u32) -> &mut Self
[src]
Sets the modification time (UNIX timestamp).
Examples
use libflate::gzip::HeaderBuilder; let header = HeaderBuilder::new().modification_time(10).finish(); assert_eq!(header.modification_time(), 10);
pub fn os(&mut self, os: Os) -> &mut Self
[src]
Sets the OS type.
use libflate::gzip::{HeaderBuilder, Os}; let header = HeaderBuilder::new().os(Os::Ntfs).finish(); assert_eq!(header.os(), Os::Ntfs);
pub fn text(&mut self) -> &mut Self
[src]
Indicates the encoding data is a ASCII text.
Examples
use libflate::gzip::HeaderBuilder; let header = HeaderBuilder::new().text().finish(); assert_eq!(header.is_text(), true);
pub fn verify(&mut self) -> &mut Self
[src]
Specifies toe verify header bytes using CRC-16.
Examples
use libflate::gzip::HeaderBuilder; let header = HeaderBuilder::new().verify().finish(); assert_eq!(header.is_verified(), true);
pub fn extra_field(&mut self, extra: ExtraField) -> &mut Self
[src]
Sets the extra field.
Examples
use libflate::gzip::{HeaderBuilder, ExtraField, ExtraSubField}; let subfield = ExtraSubField{id: [0, 1], data: vec![2, 3, 4]}; let extra = ExtraField{subfields: vec![subfield]}; let header = HeaderBuilder::new().extra_field(extra.clone()).finish(); assert_eq!(header.extra_field(), Some(&extra));
pub fn filename(&mut self, filename: CString) -> &mut Self
[src]
Sets the file name.
Examples
use std::ffi::CString; use libflate::gzip::HeaderBuilder; let header = HeaderBuilder::new().filename(CString::new("foo").unwrap()).finish(); assert_eq!(header.filename(), Some(&CString::new("foo").unwrap()));
pub fn comment(&mut self, comment: CString) -> &mut Self
[src]
Sets the comment.
Examples
use std::ffi::CString; use libflate::gzip::HeaderBuilder; let header = HeaderBuilder::new().comment(CString::new("foo").unwrap()).finish(); assert_eq!(header.comment(), Some(&CString::new("foo").unwrap()));
pub fn finish(&self) -> Header
[src]
Returns the result header.
Trait Implementations
impl Clone for HeaderBuilder
[src]
fn clone(&self) -> HeaderBuilder
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for HeaderBuilder
[src]
impl Default for HeaderBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for HeaderBuilder
impl Send for HeaderBuilder
impl Sync for HeaderBuilder
impl Unpin for HeaderBuilder
impl UnwindSafe for HeaderBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,