(reader: &[u8])
| 37 | pub type UnwindData = UnwindDataV4; |
| 38 | impl UnwindData { |
| 39 | pub fn parse(reader: &[u8]) -> anyhow::Result<Self> { |
| 40 | let compat: UnwindDataCompat = bincode::deserialize(reader)?; |
| 41 | |
| 42 | match compat { |
| 43 | UnwindDataCompat::V1(_) => { |
| 44 | anyhow::bail!("Cannot parse V1 unwind data as V4 (breaking changes)") |
| 45 | } |
| 46 | UnwindDataCompat::V2(_) => { |
| 47 | anyhow::bail!("Cannot parse V2 unwind data as V4 (breaking changes)") |
| 48 | } |
| 49 | UnwindDataCompat::V3(v3) => Ok(v3.into()), |
| 50 | UnwindDataCompat::V4(v4) => Ok(v4), |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | pub fn save_to<P: AsRef<std::path::Path>>(&self, folder: P, key: &str) -> anyhow::Result<()> { |
| 55 | let path = folder.as_ref().join(format!("{key}.{UNWIND_FILE_EXT}")); |
no outgoing calls
no test coverage detected