MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / try_fetch

Method try_fetch

flow-rs/src/broker.rs:137–147  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

135 }
136
137 pub fn try_fetch<T>(&self) -> Option<T>
138 where
139 T: 'static + Clone + std::marker::Send,
140 {
141 self.sub.try_recv().ok().map(|mut envelope| {
142 let envelope = envelope
143 .downcast_mut::<Envelope<T>>()
144 .expect("type error when downcast");
145 envelope.unpack()
146 })
147 }
148
149 pub fn topic(&self) -> &str {
150 self.topic.as_str()

Callers

nothing calls this directly

Calls 2

try_recvMethod · 0.80
unpackMethod · 0.80

Tested by

no test coverage detected