#[litenum::ium] #[derive(Debug, PartialEq)] pub enum AnkerTarget { _blank, _self, _top, _parent, } #[litenum::ium] pub(in crate) enum _PubWithScope {} fn main() { let a_tag = format!(r#"click me!"#, "https://example.com", AnkerTarget::_blank.lit(), ); assert_eq!( a_tag, r#"click me!"# ); let target = a_tag .trim_start_matches("').unwrap().0 .split_whitespace() .find(|tokens| tokens.starts_with("target=")).unwrap() .strip_prefix("target=").unwrap() .trim_matches('"'); assert_eq!( AnkerTarget::from_lit(target), Some(AnkerTarget::_blank) ); }