Skip to main content

Cache

Struct Cache 

Source
pub struct Cache<PAGE: PageStatesCache, POINTERS: PagePointersCache, KEYS: KeyPointersCache<KEY>, KEY = ()> { /* private fields */ }
Expand description

A cache object of which the various things it keeps track of can be configured..

This cache has to be kept around and passed to every api call to the same memory region until the cache gets discarded.

Valid usecase:
Create cache 1 -> use 1 -> use 1 -> create cache 2 -> use 2 -> use 2

Invalid usecase:
Create cache 1 -> use 1 -> create cache 2 -> use 2 -> ❌ use 1 ❌

Make sure the page count is correct when it has to be provided. If the number is lower than the actual amount, the code will panic.

Implementations§

Source§

impl<PAGE: PageStatesCache, POINTERS: PagePointersCache, KEYS: KeyPointersCache<KEY>, KEY> Cache<PAGE, POINTERS, KEYS, KEY>

Source

pub fn new( page_states: PAGE, page_pointers: POINTERS, key_pointers: KEYS, ) -> Self

Create a new cache object from the given subcaches

Source§

impl<KEY> Cache<Uncached, Uncached, Uncached, KEY>

Source

pub const fn new_uncached() -> Self

Create a new cache object that doesn’t cache anything

Trait Implementations§

Source§

impl<PAGE: PageStatesCache, POINTERS: PagePointersCache, KEYS: KeyPointersCache<KEY>, KEY> CacheImpl<KEY> for Cache<PAGE, POINTERS, KEYS, KEY>

Source§

impl<PAGE: Debug + PageStatesCache, POINTERS: Debug + PagePointersCache, KEYS: Debug + KeyPointersCache<KEY>, KEY: Debug> Debug for Cache<PAGE, POINTERS, KEYS, KEY>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<PAGE, POINTERS, KEYS, KEY> Freeze for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: Freeze, POINTERS: Freeze, KEYS: Freeze,

§

impl<PAGE, POINTERS, KEYS, KEY> RefUnwindSafe for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: RefUnwindSafe, POINTERS: RefUnwindSafe, KEYS: RefUnwindSafe, KEY: RefUnwindSafe,

§

impl<PAGE, POINTERS, KEYS, KEY> Send for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: Send, POINTERS: Send, KEYS: Send, KEY: Send,

§

impl<PAGE, POINTERS, KEYS, KEY> Sync for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: Sync, POINTERS: Sync, KEYS: Sync, KEY: Sync,

§

impl<PAGE, POINTERS, KEYS, KEY> Unpin for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: Unpin, POINTERS: Unpin, KEYS: Unpin, KEY: Unpin,

§

impl<PAGE, POINTERS, KEYS, KEY> UnsafeUnpin for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: UnsafeUnpin, POINTERS: UnsafeUnpin, KEYS: UnsafeUnpin,

§

impl<PAGE, POINTERS, KEYS, KEY> UnwindSafe for Cache<PAGE, POINTERS, KEYS, KEY>
where PAGE: UnwindSafe, POINTERS: UnwindSafe, KEYS: UnwindSafe, KEY: UnwindSafe,

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.