pub struct AtomicTag {
pub name: &'static str,
pub action: ActionKind,
pub args: &'static [&'static str],
}Expand description
Atomic MXP tags, such as <A>.
Fields§
§name: &'static strTag name, such as "A".
action: ActionKindAction applied by the tag.
args: &'static [&'static str]Arguments supported by the tag, such as "href".
Implementations§
Source§impl AtomicTag
impl AtomicTag
Sourcepub fn decode<'a, D: Decoder>(
&self,
args: &'a Arguments<'a>,
decoder: D,
) -> Result<Action<Cow<'a, str>>>
pub fn decode<'a, D: Decoder>( &self, args: &'a Arguments<'a>, decoder: D, ) -> Result<Action<Cow<'a, str>>>
Resolves an AtomicTag into an Action by decoding arguments and supplying them to the
tag’s definition.
Sourcepub const fn supports(&self, arg: &str) -> bool
pub const fn supports(&self, arg: &str) -> bool
Returns true if this library’s definition of the tag supports a specific argument.
Case-insensitive.
§Examples
const COLOR: &mxp::AtomicTag = mxp::AtomicTag::well_known("color").unwrap();
assert!(COLOR.supports("fore"));
assert!(!COLOR.supports("invalid_arg"));Sourcepub const fn well_known(name: &str) -> Option<&'static Self>
pub const fn well_known(name: &str) -> Option<&'static Self>
Returns an AtomicTag if name is a well-known MXP tag, such as "A" or "image".
Case-insensitive.
§Examples
let em = mxp::AtomicTag::well_known("em").unwrap();
assert_eq!(em.action, mxp::ActionKind::Italic);Trait Implementations§
impl Copy for AtomicTag
impl Eq for AtomicTag
impl StructuralPartialEq for AtomicTag
Auto Trait Implementations§
impl Freeze for AtomicTag
impl RefUnwindSafe for AtomicTag
impl Send for AtomicTag
impl Sync for AtomicTag
impl Unpin for AtomicTag
impl UnsafeUnpin for AtomicTag
impl UnwindSafe for AtomicTag
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more