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
impl GraphCache
Sourcepub fn new(limits: GraphCacheLimits) -> Self
pub fn new(limits: GraphCacheLimits) -> Self
An empty cache bounded by one host-chosen retention budget.
Sourcepub fn build_rust_graph(
&mut self,
snapshot: &RustResolutionSnapshot,
resolution: &RustTargetResolution,
limits: GraphLimits,
) -> Result<CachedCodeGraph, GraphBuildError>
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.
Sourcepub fn stats(&self) -> GraphCacheStats
pub fn stats(&self) -> GraphCacheStats
What this cache has done so far.