Enum tgbot::types::TextEntity
source · pub enum TextEntity {
Show 18 variants
Blockquote(TextEntityPosition),
Bold(TextEntityPosition),
BotCommand(TextEntityPosition),
Cashtag(TextEntityPosition),
Code(TextEntityPosition),
CustomEmoji {
custom_emoji_id: String,
position: TextEntityPosition,
},
Email(TextEntityPosition),
Hashtag(TextEntityPosition),
Italic(TextEntityPosition),
Mention(TextEntityPosition),
PhoneNumber(TextEntityPosition),
Pre {
position: TextEntityPosition,
language: Option<String>,
},
Spoiler(TextEntityPosition),
Strikethrough(TextEntityPosition),
TextLink {
position: TextEntityPosition,
url: String,
},
TextMention {
position: TextEntityPosition,
user: User,
},
Underline(TextEntityPosition),
Url(TextEntityPosition),
}
Expand description
Represents an entity in a text.
Variants§
Blockquote(TextEntityPosition)
A block quotation.
Bold(TextEntityPosition)
A bold text.
BotCommand(TextEntityPosition)
A bot command.
Cashtag(TextEntityPosition)
A cashtag.
Code(TextEntityPosition)
A monospace string.
CustomEmoji
An inline custom emoji sticker.
Fields
§
custom_emoji_id: String
Unique identifier of the custom emoji.
Use crate::types::GetCustomEmojiStickers
to get full information about the sticker.
§
position: TextEntityPosition
Position of entity in text.
Email(TextEntityPosition)
An E-Mail.
Hashtag(TextEntityPosition)
A hashtag.
Italic(TextEntityPosition)
An italic text.
Mention(TextEntityPosition)
A user mention (e.g. @username).
PhoneNumber(TextEntityPosition)
A phone number.
Pre
A monospace block.
Fields
§
position: TextEntityPosition
The position of the entity in the text.
Spoiler(TextEntityPosition)
A spoiler message.
Strikethrough(TextEntityPosition)
A strikethrough text.
TextLink
A clickable text URLs.
Fields
§
position: TextEntityPosition
The position of the entity in the text.
TextMention
A user mention without a username.
Fields
§
position: TextEntityPosition
The position of the entity in the text.
Underline(TextEntityPosition)
An underlined text.
Url(TextEntityPosition)
An URL.
Implementations§
source§impl TextEntity
impl TextEntity
sourcepub fn blockquote<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn blockquote<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn bold<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn bold<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn bot_command<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn bot_command<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn cashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn cashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn code<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn code<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn email<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn email<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn hashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn hashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn italic<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn italic<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn mention<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn mention<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn phone_number<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn phone_number<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn spoiler<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn spoiler<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn strikethrough<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn strikethrough<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn underline<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
pub fn underline<T: Into<TextEntityPosition>>(pos: T) -> TextEntity
sourcepub fn custom_emoji<P: Into<TextEntityPosition>, I: Into<String>>(
pos: P,
custom_emoji_id: I
) -> TextEntity
pub fn custom_emoji<P: Into<TextEntityPosition>, I: Into<String>>( pos: P, custom_emoji_id: I ) -> TextEntity
Creates a new TextEntity
.
§Arguments
pos
- Position of the entity in UTF-16 code units.custom_emoji_id
- Unique identifier of the custom emoji.
sourcepub fn pre<P: Into<TextEntityPosition>, L: Into<String>>(
pos: P,
language: Option<L>
) -> TextEntity
pub fn pre<P: Into<TextEntityPosition>, L: Into<String>>( pos: P, language: Option<L> ) -> TextEntity
Creates a new TextEntity
.
§Arguments
pos
- Position of the entity in UTF-16 code units.language
- The programming language of the entity text.
sourcepub fn text_link<P: Into<TextEntityPosition>, U: Into<String>>(
pos: P,
url: U
) -> TextEntity
pub fn text_link<P: Into<TextEntityPosition>, U: Into<String>>( pos: P, url: U ) -> TextEntity
Creates a new TextEntity
.
§Arguments
pos
- The position of the entity in UTF-16 code units.url
- The URL that will be opened after user taps on the text.
sourcepub fn text_mention<P: Into<TextEntityPosition>>(
pos: P,
user: User
) -> TextEntity
pub fn text_mention<P: Into<TextEntityPosition>>( pos: P, user: User ) -> TextEntity
Creates a new TextEntity
.
§Arguments
pos
- The position of the entity in UTF-16 code units.user
- The user to be mentioned.
Trait Implementations§
source§impl Clone for TextEntity
impl Clone for TextEntity
source§fn clone(&self) -> TextEntity
fn clone(&self) -> TextEntity
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TextEntity
impl Debug for TextEntity
source§impl<'de> Deserialize<'de> for TextEntity
impl<'de> Deserialize<'de> for TextEntity
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl FromIterator<TextEntity> for TextEntities
impl FromIterator<TextEntity> for TextEntities
source§fn from_iter<T: IntoIterator<Item = TextEntity>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = TextEntity>>(iter: T) -> Self
Creates a value from an iterator. Read more
source§impl PartialEq for TextEntity
impl PartialEq for TextEntity
source§fn eq(&self, other: &TextEntity) -> bool
fn eq(&self, other: &TextEntity) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for TextEntity
impl PartialOrd for TextEntity
source§fn partial_cmp(&self, other: &TextEntity) -> Option<Ordering>
fn partial_cmp(&self, other: &TextEntity) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for TextEntity
impl Serialize for TextEntity
impl StructuralPartialEq for TextEntity
Auto Trait Implementations§
impl Freeze for TextEntity
impl RefUnwindSafe for TextEntity
impl Send for TextEntity
impl Sync for TextEntity
impl Unpin for TextEntity
impl UnwindSafe for TextEntity
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more