Skip to main content

ZipIdentifier

Struct ZipIdentifier 

Source
pub struct ZipIdentifier<T: ContentType> { /* private fields */ }
Expand description

A ContentIdentifier for ZIP archives.

Fast identification is the local-file magic PK\x03\x04. validate then looks for an End of Central Directory record in the tail of the content, so a file that merely starts with those four bytes is rejected. Identification is by content, not by .zip extension.

ⓘ
let mut scanner = ScannerBuilder::<MyTypes>::new()
    .add_identifier(MyTypes::Zip, ZipIdentifier::new())
    .build();

Implementations§

Source§

impl<T: ContentType> ZipIdentifier<T>

Source

pub fn new() -> Self

Creates a new ZIP identifier.

Trait Implementations§

Source§

impl<T: ContentType> ContentIdentifier<T> for ZipIdentifier<T>

Source§

fn identify_method(&self) -> Option<IdentifyMethod>

Returns the fast pre-filter used by the scanner, if any. Read more
Source§

fn validate(&self, content: &mut dyn Content<T>) -> bool

Confirms that content is really of the type this identifier is registered for. Read more
Source§

impl<T: ContentType> Default for ZipIdentifier<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ZipIdentifier<T>
where PhantomData<T>: Freeze,

§

impl<T> RefUnwindSafe for ZipIdentifier<T>

§

impl<T> Send for ZipIdentifier<T>
where PhantomData<T>: Send,

§

impl<T> Sync for ZipIdentifier<T>
where PhantomData<T>: Sync,

§

impl<T> Unpin for ZipIdentifier<T>
where PhantomData<T>: Unpin,

§

impl<T> UnsafeUnpin for ZipIdentifier<T>

§

impl<T> UnwindSafe for ZipIdentifier<T>

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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.