Skip to main content

GraphCache

Struct GraphCache 

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

A caller-owned cache of graphs built from complete resolution claims.

The cache is mutated through &mut self, so a host chooses its own synchronization policy for construction. Every handle it returns may outlive it and may be shared across threads.

Implementations§

Source§

impl GraphCache

Source

pub fn new(limits: GraphCacheLimits) -> Self

An empty cache bounded by one host-chosen retention budget.

Source

pub fn build_rust_graph( &mut self, snapshot: &RustResolutionSnapshot, resolution: &RustTargetResolution, limits: GraphLimits, ) -> Result<CachedCodeGraph, GraphBuildError>

Project one snapshot-bound Rust resolution, reusing an exact earlier answer when the caller states exactly the same claim.

The returned graph is the one crate::build_rust_graph_with_limits returns for the same arguments, whatever this cache retained first.

§Errors

The same refusals as the direct builders. Both identity refusals are taken before any retained state is examined, so a mismatched pairing cannot be answered from, or recorded against, this cache.

Source

pub fn stats(&self) -> GraphCacheStats

What this cache has done so far.

Source

pub fn clear(&mut self)

Drop every retained graph and every retained source projection.

Cumulative statistics are not reset, and no handle a caller holds is invalidated: the cache drops its own strong references and nothing else.

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.