use std::io::{Read, Seek}; use anyhow::*; use serde_derive::{Deserialize, Serialize}; use zip::read::ZipArchive; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct PluginMeta { pub name: String, pub version: String, } pub fn read(zip: &mut ZipArchive) -> Result { let file = zip.by_name("plugin.toml").context("missing plugin.toml")?; let bytes = file.bytes().try_collect::>().context("bad bytes")?; Ok(toml::from_slice::(&bytes).context("invalid plugin.toml")?) }