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.

§language: Option<String>

The name of the programming language.

§

Spoiler(TextEntityPosition)

A spoiler message.

§

Strikethrough(TextEntityPosition)

A strikethrough text.

A clickable text URLs.

Fields

§position: TextEntityPosition

The position of the entity in the text.

§url: String

URL that will be opened after user taps on the text.

§

TextMention

A user mention without a username.

Fields

§position: TextEntityPosition

The position of the entity in the text.

§user: User

The mentioned user.

§

Underline(TextEntityPosition)

An underlined text.

§

Url(TextEntityPosition)

An URL.

Implementations§

source§

impl TextEntity

source

pub fn blockquote<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn bold<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn bot_command<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn cashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn code<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn email<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn hashtag<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn italic<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn mention<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn phone_number<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn spoiler<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn strikethrough<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

pub fn underline<T: Into<TextEntityPosition>>(pos: T) -> TextEntity

Creates a new TextEntity.

§Arguments
  • pos - Position of TextEntity in UTF-16 code units.
source

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.
source

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.

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.
source

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

source§

fn clone(&self) -> TextEntity

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TextEntity

source§

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

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

impl<'de> Deserialize<'de> for TextEntity

source§

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

source§

fn from_iter<T: IntoIterator<Item = TextEntity>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl PartialEq for TextEntity

source§

fn eq(&self, other: &TextEntity) -> 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 PartialOrd for TextEntity

source§

fn partial_cmp(&self, other: &TextEntity) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for TextEntity

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for TextEntity

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> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,