use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct Site { pub url: String, pub name: Option, } #[derive(Debug)] pub enum NamesError { FileAccessError, ParseError, } pub fn load_names(names: String) -> Result, NamesError> { match serde_json::from_str::>(&names) { Ok(content) => Ok(content), Err(_) => Err(NamesError::ParseError) } }