Struct pmd_farc::FileNameIndex [−][src]
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]
&mut self,
hash: u32,
offset: u32,
lenght: u32
) -> Result<(), FileNameError>
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]
&mut self,
name: String,
offset: u32,
lenght: u32
) -> Result<(), FileNameError>
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]
fn default() -> FileNameIndex
[src]
Auto Trait Implementations
impl RefUnwindSafe for FileNameIndex
impl Send for FileNameIndex
impl Sync for FileNameIndex
impl Unpin for FileNameIndex
impl UnwindSafe for FileNameIndex
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, 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>,