Enum twilight_mention::parse::ParseMentionErrorType

source ·
#[non_exhaustive]
pub enum ParseMentionErrorType<'a> { IdNotU64 { found: &'a str, }, ExtraneousPart { found: &'a str, }, LeadingArrow { found: Option<char>, }, PartMissing { expected: usize, found: usize, }, Sigil { expected: &'a [&'a str], found: Option<char>, }, TimestampStyleInvalid { found: &'a str, }, TrailingArrow { found: Option<char>, }, }
Expand description

Type of ParseMentionError that occurred.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

IdNotU64

ID portion of the mention isn’t a u64.

Fields

§found: &'a str

String that could not be parsed into a u64.

§

ExtraneousPart

An extra part was found that shouldn’t be present.

Fields

§found: &'a str

The extra part that was found.

§

LeadingArrow

Leading arrow (<) is not present.

Fields

§found: Option<char>

Character that was instead found where the leading arrow should be.

§

PartMissing

One or more parts of the mention are missing.

For example, an emoji mention - <:name:id> - has two parts: the name and the id, separated by the sigil (:). If the second sigil denoting the second part can’t be found, then it is missing.

Fields

§expected: usize

Number of parts that are expected.

§found: usize

Number of parts that have been found.

§

Sigil

Mention’s sigil is not present.

Users, for example, have the sigil @.

Fields

§expected: &'a [&'a str]

Possible sigils that were expected for the mention type.

§found: Option<char>

Character that was instead found where the sigil should be.

§

TimestampStyleInvalid

Timestamp style value is invalid.

Fields

§found: &'a str

Value of the style.

§

TrailingArrow

Trailing arrow (>) is not present.

Fields

§found: Option<char>

Character that was instead found where the trailing arrow should be.

Trait Implementations§

source§

impl<'a> Debug for ParseMentionErrorType<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for ParseMentionErrorType<'a>

source§

fn eq(&self, other: &ParseMentionErrorType<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for ParseMentionErrorType<'a>

source§

impl<'a> StructuralPartialEq for ParseMentionErrorType<'a>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.