#[non_exhaustive]
pub enum EntityKind {
}
Expand description
Represents an entity’s kind.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Mention
A mention.
Hashtag
A hashtag.
Cashtag
A cashtag (e.g. $TBOT
).
BotCommand
A bot command.
Url
An url.
An email.
PhoneNumber
A phone number.
Bold
Text in bold.
Italic
Text in italic.
Underline
Underlined text.
Strikethrough
Strikethrough text.
Code
String of monowidth text.
Pre(Option<String>)
Block of monowidth text.
TextLink(String)
A clickable text url.
TextMention(User)
A mention for users without username.
Implementations§
source§impl EntityKind
impl EntityKind
sourcepub fn is_mention(&self) -> bool
pub fn is_mention(&self) -> bool
Returns true
if self
is of variant Mention
.
sourcepub fn is_hashtag(&self) -> bool
pub fn is_hashtag(&self) -> bool
Returns true
if self
is of variant Hashtag
.
sourcepub fn is_cashtag(&self) -> bool
pub fn is_cashtag(&self) -> bool
Returns true
if self
is of variant Cashtag
.
sourcepub fn is_bot_command(&self) -> bool
pub fn is_bot_command(&self) -> bool
Returns true
if self
is of variant BotCommand
.
sourcepub fn is_phone_number(&self) -> bool
pub fn is_phone_number(&self) -> bool
Returns true
if self
is of variant PhoneNumber
.
sourcepub fn is_underline(&self) -> bool
pub fn is_underline(&self) -> bool
Returns true
if self
is of variant Underline
.
sourcepub fn is_strikethrough(&self) -> bool
pub fn is_strikethrough(&self) -> bool
Returns true
if self
is of variant Strikethrough
.
sourcepub fn expect_pre(self) -> Option<String>where
Self: Debug,
pub fn expect_pre(self) -> Option<String>where
Self: Debug,
sourcepub fn pre(self) -> Option<Option<String>>
pub fn pre(self) -> Option<Option<String>>
Returns Some
if self
is of variant Pre
, and None
otherwise.
sourcepub fn is_text_link(&self) -> bool
pub fn is_text_link(&self) -> bool
Returns true
if self
is of variant TextLink
.
sourcepub fn expect_text_link(self) -> Stringwhere
Self: Debug,
pub fn expect_text_link(self) -> Stringwhere
Self: Debug,
sourcepub fn text_link(self) -> Option<String>
pub fn text_link(self) -> Option<String>
Returns Some
if self
is of variant TextLink
, and None
otherwise.
sourcepub fn is_text_mention(&self) -> bool
pub fn is_text_mention(&self) -> bool
Returns true
if self
is of variant TextMention
.
sourcepub fn expect_text_mention(self) -> Userwhere
Self: Debug,
pub fn expect_text_mention(self) -> Userwhere
Self: Debug,
Unwraps the value, yielding the content of TextMention
.
Panics
Panics if the value is not TextMention
, with a panic message including the content of self
.
sourcepub fn text_mention(self) -> Option<User>
pub fn text_mention(self) -> Option<User>
Returns Some
if self
is of variant TextMention
, and None
otherwise.
Trait Implementations§
source§impl Clone for EntityKind
impl Clone for EntityKind
source§fn clone(&self) -> EntityKind
fn clone(&self) -> EntityKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EntityKind
impl Debug for EntityKind
source§impl Hash for EntityKind
impl Hash for EntityKind
source§impl PartialEq<EntityKind> for EntityKind
impl PartialEq<EntityKind> for EntityKind
source§fn eq(&self, other: &EntityKind) -> bool
fn eq(&self, other: &EntityKind) -> bool
self
and other
values to be equal, and is used
by ==
.