(&self)
| 123 | } |
| 124 | |
| 125 | pub async fn fetch<T>(&self) -> Result<T, RecvError> |
| 126 | where |
| 127 | T: 'static + Clone + std::marker::Send, |
| 128 | { |
| 129 | self.sub.recv().await.map(|mut envelope| { |
| 130 | let envelope = envelope |
| 131 | .downcast_mut::<Envelope<T>>() |
| 132 | .expect("type error when downcast"); |
| 133 | envelope.unpack() |
| 134 | }) |
| 135 | } |
| 136 | |
| 137 | pub fn try_fetch<T>(&self) -> Option<T> |
| 138 | where |