events: Adjust docs for MessageType::data

This commit is contained in:
Jonas Platte 2021-09-27 12:52:47 +02:00
parent cd4344115d
commit fde518ea89
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -258,7 +258,7 @@ impl MessageType {
/// Returns the associated data. /// Returns the associated data.
/// ///
/// Prefer to use the public variants of `MessageType` where possible; this method is meant to /// Prefer to use the public variants of `MessageType` where possible; this method is meant to
/// be used for unsupported message types only. /// be used for custom message types only.
pub fn data(&self) -> Cow<'_, JsonObject> { pub fn data(&self) -> Cow<'_, JsonObject> {
fn serialize<T: Serialize>(obj: &T) -> JsonObject { fn serialize<T: Serialize>(obj: &T) -> JsonObject {
match serde_json::to_value(obj).expect("message type serialization to succeed") { match serde_json::to_value(obj).expect("message type serialization to succeed") {