Unpacks the contents of the message if it is of type `M`
(&self)
| 309 | |
| 310 | /// Unpacks the contents of the message if it is of type `M` |
| 311 | pub fn unpack<M: ProstMessageExt>(&self) -> Result<Option<M>, ArrowError> { |
| 312 | if !self.is::<M>() { |
| 313 | return Ok(None); |
| 314 | } |
| 315 | let m = Message::decode(&*self.value) |
| 316 | .map_err(|err| ArrowError::ParseError(format!("Unable to decode Any value: {err}")))?; |
| 317 | Ok(Some(m)) |
| 318 | } |
| 319 | |
| 320 | /// Packs a message into an [`Any`] message |
| 321 | pub fn pack<M: ProstMessageExt>(message: &M) -> Result<Any, ArrowError> { |