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

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

Represents a parsed entity.

Variants

Code(String)

Inline code.

Pre

A code block.

Show fields

Fields of Pre

language: Option<String>

The code’s programming language.

value: String

The code.

Semantic(SemanticEntity)

Text that may have semantic meaning.

Implementations

impl Entity[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 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>[src]

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

Trait Implementations

impl Clone for Entity[src]

impl Debug for Entity[src]

impl Formattable for Entity[src]

impl Formattable for Entity[src]

impl Hash for Entity[src]

impl PartialEq<Entity> for Entity[src]

impl Eq for Entity[src]

impl StructuralEq for Entity[src]

impl StructuralPartialEq for Entity[src]

Auto Trait Implementations

impl RefUnwindSafe for Entity

impl Send for Entity

impl Sync for Entity

impl Unpin for Entity

impl UnwindSafe for Entity

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<T> From<T> for T[src]

impl<T> Instrument for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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> Formattable for T where
    T: Formattable + Formattable
[src]