[][src]Enum tbot::util::entities::Entity

pub enum Entity<'a> {
    Code(String),
    Pre {
        language: Option<&'a str>,
        value: String,
    },
    Semantic(SemanticEntity<'a>),
}

Represents a parsed entity.

Variants

Code(String)

Inline code.

Pre

A code block.

Fields of Pre

language: Option<&'a str>

The code's programming language.

value: String

The code.

Semantic(SemanticEntity<'a>)

Text that may have semantic meaning.

Implementations

impl<'a> Entity<'a>[src]

pub fn is_code(&self) -> bool[src]

Returns true if self is of variant Code.

pub fn expect_code(self) -> String where
    Self: Debug
[src]

Unwraps the value, yielding the content of Code.

Panics

Panics if the value is not Code, with a panic message including the content of self.

pub fn code(self) -> Option<String>[src]

Returns Some if self is of variant Code, and None otherwise.

pub fn is_pre(&self) -> bool[src]

Returns true if self is of variant Pre.

pub fn is_semantic(&self) -> bool[src]

Returns true if self is of variant Semantic.

pub fn expect_semantic(self) -> SemanticEntity<'a> where
    Self: Debug
[src]

Unwraps the value, yielding the content of Semantic.

Panics

Panics if the value is not Semantic, with a panic message including the content of self.

pub fn semantic(self) -> Option<SemanticEntity<'a>>[src]

Returns Some if self is of variant Semantic, and None otherwise.

Trait Implementations

impl<'a> Clone for Entity<'a>[src]

impl<'a> Debug for Entity<'a>[src]

impl<'a> Eq for Entity<'a>[src]

impl<'a> Formattable for Entity<'a>[src]

impl<'a> Formattable for Entity<'a>[src]

impl<'a> Hash for Entity<'a>[src]

impl<'a> PartialEq<Entity<'a>> for Entity<'a>[src]

impl<'a> StructuralEq for Entity<'a>[src]

impl<'a> StructuralPartialEq for Entity<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Entity<'a>

impl<'a> Send for Entity<'a>

impl<'a> Sync for Entity<'a>

impl<'a> Unpin for Entity<'a>

impl<'a> UnwindSafe for Entity<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Formattable for T where
    T: Formattable + Formattable
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]