Struct Archive

Source
pub struct Archive { /* private fields */ }

Implementations§

Source§

impl Archive

Source

pub fn new() -> Self

Creates a new archive with an empty entry table.

Source§

impl Archive

Source

pub fn contains_key<S>(&self, key: S) -> bool
where S: Into<String>,

Returns true if the entry table contains the specified key.

Source

pub fn remove<S>(&mut self, key: S) -> Option<Vec<u8>>
where S: Into<String>,

Removes an entry.

Source

pub fn clear(&mut self)

Clears the entry table of this archive

Source

pub fn len(&self) -> usize

Returns the number of entries this archive contains.

Examples found in repository?
examples/read_file.rs (line 10)
6fn main() -> Result<()> {
7    let path = Path::new("release/jagex.jag");
8    let archive = Archive::try_from(path)?;
9
10    println!("archive entry size: {}", archive.len());
11    Ok(())
12}
Source

pub fn is_empty(&self) -> bool

Returns true if the archive contains no entries

Trait Implementations§

Source§

impl Clone for Archive

Source§

fn clone(&self) -> Archive

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Archive

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Archive

Source§

fn default() -> Archive

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

impl ReadArchive for Archive

Source§

fn get<S>(&self, key: S) -> Option<&Vec<u8>>
where S: Into<String>,

Gets a reference to an entry from an archive, if it exists.
Source§

fn get_mut<S>(&mut self, key: S) -> Option<&mut Vec<u8>>
where S: Into<String>,

Gets a mutable reference to an entry from an archive, if it exists.
Source§

impl TryFrom<&Path> for Archive

Source§

fn try_from(path: &Path) -> Result<Self, Error>

Attempts to read an existing archive from disk into a new archive.

Source§

type Error = Error

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

impl WriteArchive for Archive

Source§

fn save(&self, path: &Path) -> Result<()>

Writes an archive to disk with the given path. If a file is already present at the given path, it is simply overwritten.
Source§

fn insert<S>(&mut self, key: S, value: Vec<u8>) -> Option<Vec<u8>>
where S: Into<String>,

Inserts a key-value pair. If the archive already contains the given key, the previous value for that key is returned.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.