Enum carapax::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>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn blockquote<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn bold<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn bold<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn bot_command<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn bot_command<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn cashtag<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn cashtag<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn code<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn code<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn email<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn email<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn hashtag<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn hashtag<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn italic<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn italic<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn mention<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn mention<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn phone_number<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn phone_number<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn spoiler<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn spoiler<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn strikethrough<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn strikethrough<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn underline<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
pub fn underline<T>(pos: T) -> TextEntitywhere
T: Into<TextEntityPosition>,
sourcepub fn custom_emoji<P, I>(pos: P, custom_emoji_id: I) -> TextEntity
pub fn custom_emoji<P, I>(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, L>(pos: P, language: Option<L>) -> TextEntity
pub fn pre<P, L>(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, U>(pos: P, url: U) -> TextEntity
pub fn text_link<P, U>(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>(pos: P, user: User) -> TextEntitywhere
P: Into<TextEntityPosition>,
pub fn text_mention<P>(pos: P, user: User) -> TextEntitywhere
P: Into<TextEntityPosition>,
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<TextEntity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<TextEntity, <__D as Deserializer<'de>>::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>(iter: T) -> TextEntitieswhere
T: IntoIterator<Item = TextEntity>,
fn from_iter<T>(iter: T) -> TextEntitieswhere
T: IntoIterator<Item = TextEntity>,
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
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl TryFrom<RawTextEntity> for TextEntity
impl TryFrom<RawTextEntity> for TextEntity
§type Error = TextEntityError
type Error = TextEntityError
The type returned in the event of a conversion error.
source§fn try_from(
raw: RawTextEntity
) -> Result<TextEntity, <TextEntity as TryFrom<RawTextEntity>>::Error>
fn try_from( raw: RawTextEntity ) -> Result<TextEntity, <TextEntity as TryFrom<RawTextEntity>>::Error>
Performs the conversion.
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more