Skip to main content

Store

Struct Store 

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

A loaded cache: what the last run stored, and what this run has produced.

Implementations§

Source§

impl Store

Source

pub fn empty() -> Self

An empty store, for a run with caching disabled.

Source

pub fn load(project_root: &Path) -> Self

Load the cache under a project root, or an empty store if there is nothing usable.

Source

pub fn get(&self, key: &CacheKey) -> Option<&Entry>

The entry for a key, if this cache has one.

Source

pub fn insert(&mut self, key: CacheKey, entry: Entry)

Record an entry for this run.

Source

pub fn keys(&self) -> impl Iterator<Item = &CacheKey>

Every key held, in order.

For tooling and tests that need to reach an entry without recomputing its key.

Source

pub fn len(&self) -> usize

How many entries are held.

Source

pub fn is_empty(&self) -> bool

Whether anything is held.

Source

pub fn save(&self, project_root: &Path)

Write the cache under a project root, replacing whatever was there.

Silent on failure by design: an unwritable .lanekeep directory means the next run is cold, which is not something to interrupt this run over.

Source

pub fn path_for(project_root: &Path) -> PathBuf

Where the cache file sits for a project.

Trait Implementations§

Source§

impl Debug for Store

Source§

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

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

impl Default for Store

Source§

fn default() -> Store

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

Auto Trait Implementations§

§

impl Freeze for Store

§

impl RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl UnwindSafe for Store

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.