(&self)
| 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() |