Struct Magic

#[repr(transparent)]
pub struct Magic(/* private field */);

These values currently always take up a fixed four bytes, so we can parse and wrap them in this struct to enforce some small amount of type safety.

Implementations

impl Magic

const LOCAL_FILE_HEADER_SIGNATURE: Self = _;

Local file header signature

const CENTRAL_DIRECTORY_HEADER_SIGNATURE: Self = _;

Central directory header signature

const CENTRAL_DIRECTORY_END_SIGNATURE: Self = _;

Central directory end signature

const CENTRAL_DIRECTORY_DIGITAL_SIGNATURE: Self = _;

Optional central directory digital signature record

const ZIP64_CENTRAL_DIRECTORY_END_SIGNATURE: Self = _;

Zip64 central directory signature

const ZIP64_CENTRAL_DIRECTORY_END_LOCATOR_SIGNATURE: Self = _;

Zip64 central directory end locator signature

const DATA_DESCRIPTOR_SIGNATURE: Self = _;

Data descriptor signature

const fn literal(x: u32) -> Self

Create new literal

const fn from_le_bytes(bytes: [u8; 4]) -> Self

Create new from bytes

const fn to_le_bytes(self) -> [u8; 4]

Get as bytes

fn from_le(self) -> Self

From little endian

fn to_le(self) -> Self

To little endian

Trait Implementations

impl Clone for Magic

fn clone(&self) -> Self

impl Copy for Magic

impl Debug for Magic

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for Magic

impl Hash for Magic

fn hash<__H: Hasher>(&self, state: &mut __H)

impl Ord for Magic

fn cmp(&self, other: &Self) -> Ordering

impl PartialEq for Magic

fn eq(&self, other: &Self) -> bool

impl PartialOrd for Magic

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

impl StructuralPartialEq for Magic

Auto Trait Implementations

impl Freeze for Magic

impl RefUnwindSafe for Magic

impl Send for Magic

impl Sync for Magic

impl Unpin for Magic

impl UnsafeUnpin for Magic

impl UnwindSafe for Magic

Blanket Implementations

impl<Q, K> Comparable<K> for Magic where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

impl<Q, K> Equivalent<K> for Magic where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

impl<Q, K> Equivalent<K> for Magic where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

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

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

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

impl<T> CloneToUninit for Magic where T: Clone,

impl<T> From<T> for Magic

impl<T> Same for Magic

impl<T> ToOwned for Magic where T: Clone,

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

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

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