Trait pircolate::tag::Tag
[−]
[src]
pub trait Tag<'a> { fn name() -> &'static str; fn parse(tag: Option<&'a str>) -> Option<Self>
where
Self: Sized; fn try_match(tags: TagIter<'a>) -> Option<Self>
where
Self: Sized, { ... } }
The tag trait is a trait implemented by types for use with the Message::tag
method.
It is used to search for a specified tag and provide stronglyy typed access to it.
Required Methods
fn name() -> &'static str
The name of the tag being searched for.
fn parse(tag: Option<&'a str>) -> Option<Self> where
Self: Sized,
Self: Sized,
This method attempts to parse the tag input into a strongly typed representation.
If parsing failes, it returns None
.
Provided Methods
fn try_match(tags: TagIter<'a>) -> Option<Self> where
Self: Sized,
Self: Sized,
A default implementation that searches for a tag with the associated name and attempts to parse it.