pub fn data(&self) -> Cow<'_, JsonObject> {
        fn serialize<T: Serialize>(obj: &T) -> JsonObject {
            match serde_json::to_value(obj).expect("message type serialization to succeed") {
                JsonValue::Object(obj) => obj,
                _ => panic!("all message types must serialize to objects"),
            }
        }

        match self {
            Self::Audio(d) => Cow::Owned(serialize(d)),
            Self::Emote(d) => Cow::Owned(serialize(d)),
            Self::File(d) => Cow::Owned(serialize(d)),
            Self::Image(d) => Cow::Owned(serialize(d)),
            Self::Location(d) => Cow::Owned(serialize(d)),
            Self::Notice(d) => Cow::Owned(serialize(d)),
            Self::ServerNotice(d) => Cow::Owned(serialize(d)),
            Self::Text(d) => Cow::Owned(serialize(d)),
            Self::Video(d) => Cow::Owned(serialize(d)),
            #[cfg(feature = "unstable-pre-spec")]
            Self::VerificationRequest(d) => Cow::Owned(serialize(d)),
            Self::_Custom(c) => Cow::Borrowed(&c.data),
        }
    }
/// Returns the associated data.
///
/// Prefer to use the public variants of `MessageType` where possible; this method is meant to
/// be used for unsupported message types only.
Returns the associated data.
Prefer to use the public variants of `MessageType` where possible; this method is meant to
be used for unsupported message types only.
Returns the associated data . Prefer to use the public variants of ` MessageType ` where possible ; this method is meant to be used for unsupported message types only .
pub fn data(&self) -> Cow<'_, JsonObject> {
        fn serialize<T: Serialize>(obj: &T) -> JsonObject {
            match serde_json::to_value(obj).expect("message type serialization to succeed") {
                JsonValue::Object(obj) => obj,
                _ => panic!("all message types must serialize to objects"),
            }
        }
        match self {
            Self::Audio(d) => Cow::Owned(serialize(d)),
            Self::Emote(d) => Cow::Owned(serialize(d)),
            Self::File(d) => Cow::Owned(serialize(d)),
            Self::Image(d) => Cow::Owned(serialize(d)),
            Self::Location(d) => Cow::Owned(serialize(d)),
            Self::Notice(d) => Cow::Owned(serialize(d)),
            Self::ServerNotice(d) => Cow::Owned(serialize(d)),
            Self::Text(d) => Cow::Owned(serialize(d)),
            Self::Video(d) => Cow::Owned(serialize(d)),
            #[cfg(feature = "unstable-pre-spec")]
            Self::VerificationRequest(d) => Cow::Owned(serialize(d)),
            Self::_Custom(c) => Cow::Borrowed(&c.data),
        }
    }
pub fn data ( & self ) -> Cow < ' _ , JsonObject > { fn serialize < T : Serialize > ( obj : & T ) -> JsonObject { match serde_json :: to_value ( obj ) . expect ( " " ) { JsonValue :: Object ( obj ) => obj , _ => panic ! ( " " ) , } } match self { Self :: Audio ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Emote ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: File ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Image ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Location ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Notice ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: ServerNotice ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Text ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: Video ( d ) => Cow :: Owned ( serialize ( d ) ) , # [ cfg ( feature " " ) ] Self :: VerificationRequest ( d ) => Cow :: Owned ( serialize ( d ) ) , Self :: _Custom ( c ) => Cow :: Borrowed ( & c . data ) , } }
Returns the associated data.
Returns the associated data .
&self