pub struct Scope { /* private fields */ }Expand description
A caching scope handle.
Caching is disabled by default. DialCache::enable
opens the outermost enabled scope and hands its Scope to the callback;
pass it to every cached call made on behalf of that request. Nested
DialCache::enable_in and
DialCache::disable_in derive child
scopes that share the outer request memo. When the outermost callback
completes its scope closes: retained clones no longer enable caching and
late work cannot publish into the request memo.
Scope::outside is the pass-through scope of code that runs on behalf of
no request: calls made with it invoke their source directly.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn outside() -> Scope
pub fn outside() -> Scope
The scope of work that runs on behalf of no request. Calls pass straight through to their source.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether caching is enabled for calls made with this scope: it was derived from an enabled scope and its outermost scope is still open.