pub struct CacheScope { /* private fields */ }Expand description
A cache scope (C++ ArResolverScopedCache): a span, on one thread,
over which work that asks for the same asset several times keeps what
it opened, such as a package’s directory. The scope ends when the guard
drops.
A scope begun while another is open on the thread shares that scope’s
cache: an operation holds one without asking whether its caller does.
A scope belongs to the thread that began it and the guard stays on that
thread; handle gives the cache for a scope on another
thread to share.
Implementations§
Source§impl CacheScope
impl CacheScope
Sourcepub fn begin() -> Self
pub fn begin() -> Self
Begins a scope on the calling thread. It shares the cache of the innermost scope open on the thread, and starts an empty one when there is none.
Begins a scope on the calling thread that shares handle’s cache,
the cache of a scope open on another thread.
TODO(rayon): nothing shares a cache across threads yet. A parallel load would begin each worker’s scope with the handle of the scope its caller holds.
Sourcepub fn handle(&self) -> CacheHandle
pub fn handle(&self) -> CacheHandle
The scope’s cache.
Sourcepub fn current() -> Option<CacheHandle>
pub fn current() -> Option<CacheHandle>
The cache of the innermost scope open on the calling thread.