pub enum RichText {
Plain(String),
Array(Vec<RichText>),
Node(Box<RichTextNode>),
}Expand description
Rich formatted text — a recursive sum type that mirrors the Telegram
RichText union from Bot API 10.1.
A RichText value is either:
These three untagged variants only ever have to tell a string from an array
from an object, which serde does reliably. The choice between formatted
node kinds is made by RichTextNode’s type tag.
This split matters: when all 25 node kinds were untagged variants of this enum they were structurally identical, so serde matched the first one and every kind of formatted text deserialized as bold.
Variants§
Plain(String)
Plain text without any formatting.
Array(Vec<RichText>)
A sequence of rich-text nodes rendered consecutively.
Node(Box<RichTextNode>)
A single formatted node.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RichText
impl<'de> Deserialize<'de> for RichText
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
Auto Trait Implementations§
impl Freeze for RichText
impl RefUnwindSafe for RichText
impl Send for RichText
impl Sync for RichText
impl Unpin for RichText
impl UnsafeUnpin for RichText
impl UnwindSafe for RichText
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