Struct await_tree::Registry
source · pub struct Registry(/* private fields */);
Expand description
The registry of multiple await-trees.
Can be cheaply cloned to share the same registry.
Implementations§
source§impl Registry
impl Registry
sourcepub fn register_anonymous(&self, root_span: impl Into<Span>) -> TreeRoot
pub fn register_anonymous(&self, root_span: impl Into<Span>) -> TreeRoot
Register an anonymous await-tree without specifying a key. Returns a TreeRoot
that can
be used to instrument a future.
Anonymous await-trees are not able to be retrieved through the Registry::get
method. Use
Registry::collect_anonymous
or Registry::collect_all
to collect them.
sourcepub fn get(&self, key: impl Key) -> Option<Tree>
pub fn get(&self, key: impl Key) -> Option<Tree>
Get a clone of the await-tree with given key.
Returns None
if the key does not exist or the tree root has been dropped.
sourcepub fn collect<K: Key + Clone>(&self) -> Vec<(K, Tree)>
pub fn collect<K: Key + Clone>(&self) -> Vec<(K, Tree)>
Collect the snapshots of all await-trees with the key of type K
.
sourcepub fn collect_anonymous(&self) -> Vec<Tree>
pub fn collect_anonymous(&self) -> Vec<Tree>
Collect the snapshots of all await-trees registered with Registry::register_anonymous
.
sourcepub fn collect_all(&self) -> Vec<(AnyKey, Tree)>
pub fn collect_all(&self) -> Vec<(AnyKey, Tree)>
Collect the snapshots of all await-trees regardless of the key type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more