pub struct CacheIndex<S: IndexState> { /* private fields */ }
Expand description

Container of Archives.

Implementations§

source§

impl CacheIndex<Initial>

source

pub fn new(index_id: u32, input: CachePath) -> CacheResult<CacheIndex<Initial>>

Constructor for CacheIndex.

Errors

Raises CacheNotFoundError if the cache database cannot be found.

source§

impl<S> CacheIndex<S>where S: IndexState,

source

pub fn get_file(&self, metadata: &Metadata) -> CacheResult<Bytes>

Executes a sql command to retrieve an archive from the cache.

source

pub fn assert_coherence(&self) -> Result<(), IntegrityError>

Assert whether the cache held by self is in a coherent state.

Errors

May raise CrcError, VersionError or ArchiveNotFoundError if the cache is not in a logical state.

Notes

Indices VORBIS, AUDIOSTREAMS, TEXTURES_PNG_MIPPED and TEXTURES_ETC tend to never complete. For these, simply ignore ArchiveNotFoundError.

source§

impl<S> CacheIndex<S>where S: IndexState,

source

pub fn index_id(&self) -> u32

The index id of self, corresponding to the raw/js5-{index_id}.jcache file being held.

source

pub fn metadatas(&self) -> &IndexMetadata

Returns a view over the IndexMetadata of self.

source

pub fn archive(&self, archive_id: u32) -> CacheResult<Archive>

Get an Archive from self.

Errors

Raises ArchiveNotFoundError if archive_id is not in self.

source§

impl CacheIndex<Initial>

source

pub fn retain(self, ids: Vec<u32>) -> CacheIndex<Truncated>

Retain only those archives that are in ids. Advances self to the Truncated state.

Panics

Panics if any of ids is not in self.

Trait Implementations§

source§

impl IntoIterator for CacheIndex<Initial>

§

type Item = Result<Archive, CacheError>

The type of the elements being iterated over.
§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for CacheIndex<Truncated>

§

type Item = Result<Archive, CacheError>

The type of the elements being iterated over.
§

type IntoIter = IntoIter

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for CacheIndex<S>

§

impl<S> Send for CacheIndex<S>where S: Send,

§

impl<S> !Sync for CacheIndex<S>

§

impl<S> Unpin for CacheIndex<S>where S: Unpin,

§

impl<S> !UnwindSafe for CacheIndex<S>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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.

§

impl<T, I> IntoPyDict for Iwhere T: PyDictItem, I: IntoIterator<Item = T>,

§

fn into_py_dict(self, py: Python<'_>) -> &PyDict

Converts self into a PyDict object pointer. Whether pointer owned or borrowed depends on implementation.
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for Twhere T: Send,