pub struct MessageEntity {
pub kind: MessageEntityKind,
pub offset: usize,
pub length: usize,
}Expand description
This object represents one special entity in a text message.
For example, hashtags, usernames, URLs, etc.
Fields§
§kind: MessageEntityKind§offset: usizeOffset in UTF-16 code units to the start of the entity.
length: usizeLength of the entity in UTF-16 code units.
Implementations§
Source§impl MessageEntity
impl MessageEntity
pub const fn new( kind: MessageEntityKind, offset: usize, length: usize, ) -> MessageEntity
Sourcepub const fn bold(offset: usize, length: usize) -> MessageEntity
pub const fn bold(offset: usize, length: usize) -> MessageEntity
Create a message entity representing a bold text.
Sourcepub const fn italic(offset: usize, length: usize) -> MessageEntity
pub const fn italic(offset: usize, length: usize) -> MessageEntity
Create a message entity representing an italic text.
Sourcepub const fn underline(offset: usize, length: usize) -> MessageEntity
pub const fn underline(offset: usize, length: usize) -> MessageEntity
Create a message entity representing an underline text.
Sourcepub const fn strikethrough(offset: usize, length: usize) -> MessageEntity
pub const fn strikethrough(offset: usize, length: usize) -> MessageEntity
Create a message entity representing a strikethrough text.
Sourcepub const fn spoiler(offset: usize, length: usize) -> MessageEntity
pub const fn spoiler(offset: usize, length: usize) -> MessageEntity
Create a message entity representing a spoiler text.
Sourcepub const fn code(offset: usize, length: usize) -> MessageEntity
pub const fn code(offset: usize, length: usize) -> MessageEntity
Create a message entity representing a monowidth text.
Sourcepub const fn pre(
language: Option<String>,
offset: usize,
length: usize,
) -> MessageEntity
pub const fn pre( language: Option<String>, offset: usize, length: usize, ) -> MessageEntity
Create a message entity representing a monowidth block.
Sourcepub const fn text_link(url: Url, offset: usize, length: usize) -> MessageEntity
pub const fn text_link(url: Url, offset: usize, length: usize) -> MessageEntity
Create a message entity representing a clickable text URL.
Sourcepub const fn text_mention(
user: User,
offset: usize,
length: usize,
) -> MessageEntity
pub const fn text_mention( user: User, offset: usize, length: usize, ) -> MessageEntity
Create a message entity representing a text mention.
§Note
If you don’t have a complete User value, please use
MessageEntity::text_mention_id instead.
Sourcepub fn text_mention_id(
user_id: UserId,
offset: usize,
length: usize,
) -> MessageEntity
pub fn text_mention_id( user_id: UserId, offset: usize, length: usize, ) -> MessageEntity
Create a message entity representing a text link in the form of
tg://user/?id=... that mentions user with user_id.
Sourcepub const fn custom_emoji(
custom_emoji_id: CustomEmojiId,
offset: usize,
length: usize,
) -> MessageEntity
pub const fn custom_emoji( custom_emoji_id: CustomEmojiId, offset: usize, length: usize, ) -> MessageEntity
Create a message entity representing a custom emoji.
pub fn kind(self, val: MessageEntityKind) -> MessageEntity
pub const fn offset(self, val: usize) -> MessageEntity
pub const fn length(self, val: usize) -> MessageEntity
Trait Implementations§
Source§impl Clone for MessageEntity
impl Clone for MessageEntity
Source§fn clone(&self) -> MessageEntity
fn clone(&self) -> MessageEntity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageEntity
impl Debug for MessageEntity
Source§impl<'de> Deserialize<'de> for MessageEntity
impl<'de> Deserialize<'de> for MessageEntity
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageEntity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageEntity, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for MessageEntity
impl Hash for MessageEntity
Source§impl PartialEq for MessageEntity
impl PartialEq for MessageEntity
Source§impl Serialize for MessageEntity
impl Serialize for MessageEntity
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,
impl Eq for MessageEntity
impl StructuralPartialEq for MessageEntity
Auto Trait Implementations§
impl Freeze for MessageEntity
impl RefUnwindSafe for MessageEntity
impl Send for MessageEntity
impl Sync for MessageEntity
impl Unpin for MessageEntity
impl UnwindSafe for MessageEntity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Erasable for T
impl<T> Erasable for T
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>
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>
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