#[non_exhaustive]pub enum MsgContent {
Text {
text: String,
undocumented: Value,
},
Link {
text: String,
preview: LinkPreview,
undocumented: Value,
},
Image {
text: String,
image: String,
undocumented: Value,
},
Video {
text: String,
image: String,
duration: i32,
undocumented: Value,
},
Voice {
text: String,
duration: i32,
undocumented: Value,
},
File {
text: String,
undocumented: Value,
},
Report {
text: String,
reason: ReportReason,
undocumented: Value,
},
Chat {
text: String,
chat_link: MsgChatLink,
owner_sig: Option<LinkOwnerSig>,
undocumented: Value,
},
Unknown {
tag: String,
text: String,
json: Value,
undocumented: Value,
},
Undocumented(Value),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl MsgContent
impl MsgContent
pub fn make_text(text: String) -> MsgContent
pub fn make_link(text: String, preview: LinkPreview) -> MsgContent
pub fn make_image(text: String, image: String) -> MsgContent
pub fn make_video(text: String, image: String, duration: i32) -> MsgContent
pub fn make_voice(text: String, duration: i32) -> MsgContent
pub fn make_file(text: String) -> MsgContent
pub fn make_report(text: String, reason: ReportReason) -> MsgContent
pub fn make_chat( text: String, chat_link: MsgChatLink, owner_sig: Option<LinkOwnerSig>, ) -> MsgContent
pub fn make_unknown(tag: String, text: String, json: Value) -> MsgContent
Source§impl MsgContent
impl MsgContent
pub fn text(&self) -> Option<&String>
pub fn link(&self) -> Option<MsgContentLinkRef<'_>>
pub fn image(&self) -> Option<MsgContentImageRef<'_>>
pub fn video(&self) -> Option<MsgContentVideoRef<'_>>
pub fn voice(&self) -> Option<MsgContentVoiceRef<'_>>
pub fn file(&self) -> Option<&String>
pub fn report(&self) -> Option<MsgContentReportRef<'_>>
pub fn chat(&self) -> Option<MsgContentChatRef<'_>>
pub fn unknown(&self) -> Option<MsgContentUnknownRef<'_>>
Trait Implementations§
Source§impl Clone for MsgContent
impl Clone for MsgContent
Source§fn clone(&self) -> MsgContent
fn clone(&self) -> MsgContent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MsgContent
impl Debug for MsgContent
Source§impl<'de> Deserialize<'de> for MsgContent
impl<'de> Deserialize<'de> for MsgContent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MsgContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MsgContent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl MessageLike for MsgContent
impl MessageLike for MsgContent
type Kind = RichKind
fn into_builder_parts(self) -> (ComposedMessage, RichKind)
Source§impl MsgContentExt for MsgContent
impl MsgContentExt for MsgContent
fn text_part(&self) -> Option<&str>
fn text_part_mut(&mut self) -> Option<&mut String>
fn preview(&self) -> Option<&str>
fn preview_mut(&mut self) -> Option<&mut String>
fn set_text_part(&mut self, new_text: impl Into<String>)
fn set_preview(&mut self, new_preview: String)
Source§impl PartialEq for MsgContent
impl PartialEq for MsgContent
Source§fn eq(&self, other: &MsgContent) -> bool
fn eq(&self, other: &MsgContent) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for MsgContent
impl Serialize for MsgContent
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
impl StructuralPartialEq for MsgContent
Auto Trait Implementations§
impl Freeze for MsgContent
impl RefUnwindSafe for MsgContent
impl Send for MsgContent
impl Sync for MsgContent
impl Unpin for MsgContent
impl UnsafeUnpin for MsgContent
impl UnwindSafe for MsgContent
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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