use unicode_segmentation::UnicodeSegmentation; #[derive(Debug)] pub struct AppDesc(pub String); impl AppDesc { pub fn parse(s: String) -> Result { if s.graphemes(true).count() > 1024 { return Err("Workspace description too long".to_string()); } Ok(Self(s)) } } impl AsRef for AppDesc { fn as_ref(&self) -> &str { &self.0 } }