MCPcopy Create free account
hub / github.com/chc4/lineiform / as_variant

Method as_variant

tangle/src/node.rs:201–203  ·  view source on GitHub ↗
(&'a self, token: &'a NodeOwner)

Source from the content-addressed store, hash-verified

199
200impl Node {
201 pub fn as_variant<'a, T>(&'a self, token: &'a NodeOwner) -> Option<&'a T> where T: 'static {
202 (&*self.variant.ro(token).deref() as &dyn NodeBehavior as &(dyn core::any::Any + 'static)).downcast_ref::<T>()
203 }
204
205 pub fn as_variant_mut<'a, T>(&'a mut self, token: &'a mut NodeOwner) -> Option<&'a mut T> where T: 'static + Clone {
206 let x = self.as_variant::<T>(token);

Callers

nothing calls this directly

Calls 1

derefMethod · 0.45

Tested by

no test coverage detected