#[derive(Debug)] pub struct NotEmptyStr(pub String); impl NotEmptyStr { pub fn parse(s: String) -> Result { if s.trim().is_empty() { return Err("Input string is empty".to_owned()); } Ok(Self(s)) } } #[derive(Debug)] pub struct NotEmptyVec(pub Vec); impl NotEmptyVec { pub fn parse(v: Vec) -> Result { if v.is_empty() { return Err("Input vector is empty".to_owned()); } Ok(Self(v)) } }