pub mod types; use std::io::BufReader; use quick_xml::{ de::{from_reader, from_str}, DeError, }; use serde::Deserialize; use types::{ConditionalFileInstallList, FileList, HeaderImage, ModuleDependency, StepList}; #[derive(Debug, Deserialize, PartialEq)] pub struct Info { #[serde(rename = "Name")] pub name: Option, #[serde(rename = "Description")] pub description: Option, #[serde(rename = "Version")] pub version: Option, #[serde(rename = "Author")] pub author: Option, #[serde(rename = "Website")] pub website: Option, #[serde(rename = "CategoryId")] pub category_id: Option, } impl TryFrom<&str> for Info { type Error = DeError; fn try_from(string: &str) -> Result { from_str(string) } } impl TryFrom> for Info where T: std::io::Read, { type Error = DeError; fn try_from(reader: BufReader) -> Result { from_reader(reader) } } #[derive(Debug, Deserialize, PartialEq)] pub struct Config { #[serde(rename = "moduleName")] pub module_name: String, #[serde(rename = "moduleImage")] pub module_image: Option, #[serde(rename = "moduleDependencies")] pub module_dependencies: Option, #[serde(rename = "requiredInstallFiles")] pub required_install_files: Option, #[serde(rename = "installSteps")] pub install_steps: Option, #[serde(rename = "conditionalFileInstalls")] pub conditional_file_installs: Option, } impl TryFrom<&str> for Config { type Error = DeError; fn try_from(string: &str) -> Result { from_str(string) } } impl TryFrom> for Config where T: std::io::Read, { type Error = DeError; fn try_from(reader: BufReader) -> Result { from_reader(reader) } }