MCPcopy Create free account
hub / github.com/BillyDM/Firewheel / or_insert_with

Method or_insert_with

crates/firewheel-core/src/node.rs:1121–1126  ·  view source on GitHub ↗
(self, default: impl FnOnce() -> S)

Source from the content-addressed store, hash-verified

1119 ///
1120 /// Returns `None` if the given resource does not exist.
1121 pub fn try_get<S: Send + 'static>(&self) -> Option<&S> {
1122 self.0
1123 .get(&TypeId::of::<S>())
1124 .map(|s| s.downcast_ref().unwrap())
1125 }
1126
1127 /// Get a mutable reference to a resource in the store.
1128 ///
1129 /// Returns `None` if the given resource does not exist.

Callers 1

or_insert_with_anyMethod · 0.80

Calls 1

downcast_mutMethod · 0.80

Tested by

no test coverage detected