CachePairReader

Struct CachePairReader 

Source
pub struct CachePairReader { /* private fields */ }
Expand description

A cache pair reader.

Implementations§

Source§

impl CachePairReader

Source

pub fn get_directory_node<T: Into<PathBuf>>(&self, path: T) -> Option<Node>

Get the directory node for the given path.

Source

pub fn get_file_node<T: Into<PathBuf>>(&self, path: T) -> Option<Node>

Get the file node for the given path.

Source

pub fn directories(&self) -> &Vec<Node>

Get the directory nodes

Source

pub fn files(&self) -> &Vec<Node>

Get the file nodes

Source

pub fn get_data(&self, file_node: Node) -> Result<Vec<u8>>

Read the data without decompressing it for the given file node.

Source

pub fn decompress_data(&self, file_node: Node) -> Result<Vec<u8>>

Read and decompress the data for the given file node.

If the file is not compressed, the data is read without decompressing it.

Trait Implementations§

Source§

impl CachePair for CachePairReader

Source§

fn new( toc_path: PathBuf, cache_path: PathBuf, is_post_ensmallening: bool, ) -> Self

Creates a new cache pair from the specified TOC and cache paths.
Source§

fn is_post_ensmallening(&self) -> bool

Returns whether the package is post-ensmallening. Read more
Source§

fn toc_path(&self) -> PathBuf

Returns the Table of Contents (TOC) file path.
Source§

fn cache_path(&self) -> PathBuf

Returns the cache file path.
Source§

fn read_toc(&mut self) -> Result<()>

Reads the TOC file. Read more
Source§

fn unread_toc(&mut self)

Unreads the TOC file. Read more
Source§

const MAGIC_NUMBER: u64 = 409_454_158u64

The magic number for the cache pair.
Source§

const ARCHIVE_VERSION: u64 = 20u64

The archive version for the cache pair.

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> 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, 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.