#[derive(Clone,Copy,Debug)] pub enum Style{ Rox, Rojo, RoxRojo, } #[derive(Default)] pub(crate) struct PropertiesOverride{ pub name:Option, pub class:Option, } impl PropertiesOverride{ pub fn is_some(&self)->bool{ self.name.is_some() ||self.class.is_some() } } impl std::fmt::Display for PropertiesOverride{ fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{ if let Some(name)=self.name.as_deref(){ writeln!(f,"--!Properties.Name = \"{}\"",name)?; } if let Some(class)=self.class.as_deref(){ writeln!(f,"--!Properties.ClassName = \"{}\"",class)?; } Ok(()) } } pub(crate) fn sanitize<'a>(s:&'a str)->std::borrow::Cow<'a,str>{ lazy_regex::regex!(r"[^A-z0-9.-]").replace_all(s,"_") }