Struct pmd_farc::FileNameIndex[][src]

pub struct FileNameIndex { /* fields omitted */ }

Represent an index of a FARC file. Each subfile have a known position and lenght related to it’s parent file, as well as the hash of the name. The full name may or may not be known for a file.

Implementations

impl FileNameIndex[src]

pub fn add_file_with_hash(
    &mut self,
    hash: u32,
    offset: u32,
    lenght: u32
) -> Result<(), FileNameError>
[src]

Add an entry in this index, with the hash being the crc32 ieee hash of the name encoded as utf16. Return an error if a conflict happen.

pub fn add_file_with_name(
    &mut self,
    name: String,
    offset: u32,
    lenght: u32
) -> Result<(), FileNameError>
[src]

Add an entry to this index, with the name being a standard string. It will internally be converted to the good hash using hash_name. Return an error if a conflict happen.

pub fn check_file_name(&mut self, name: &str) -> bool[src]

If a file is found in the index that have a file name hash that correspond to the given name. If it does, return true, and save this name. otherwise, return false.

If there is a conflict found, do nothing and return false

#[must_use]pub fn get_file_by_name(&self, name: &str) -> Option<&FarcFile>[src]

Return the file with the given name (the hash of the name is also tested, but not saved). If there is a conflict with the hash value, None is returned.

#[must_use]pub fn get_file_by_hash(&self, hash: u32) -> Option<&FarcFile>[src]

Return the file with the conresponding file name hash.

#[must_use]pub fn len(&self) -> usize[src]

return the total number of registered file in this index.

#[must_use]pub fn is_empty(&self) -> bool[src]

return true is the this farc archive don’t have any file

pub fn iter(&self) -> impl Iterator<Item = &FarcFile>[src]

iterate over all the file entry, sorted by addition order.

Trait Implementations

impl Debug for FileNameIndex[src]

impl Default for FileNameIndex[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.