(path: &std::path::Path)
| 153 | } |
| 154 | |
| 155 | pub fn load_json<T: serde::de::DeserializeOwned>(path: &std::path::Path) -> anyhow::Result<T> { |
| 156 | serde_json::from_slice( |
| 157 | &std::fs::read(path).with_context(|| format!("failed to read: {}", path.display()))?, |
| 158 | ) |
| 159 | .with_context(|| format!("failed to parse: {}", path.display())) |
| 160 | } |
| 161 | |
| 162 | /// Retrivies the address and size of all streams in `data` with an non-zero length. |
| 163 | pub(crate) fn get_non_empty_streams(data: &MultiStream) -> Vec<(StreamKey, usize)> { |
no outgoing calls