events: Remove Serialize implementation of unsigned types
This commit is contained in:
parent
67d0f3cc04
commit
2a37e4d109
@ -126,7 +126,7 @@ pub trait StateEventContent: EventContent<EventType = StateEventType> {
|
|||||||
type StateKey: AsRef<str> + Clone + fmt::Debug + DeserializeOwned + Serialize;
|
type StateKey: AsRef<str> + Clone + fmt::Debug + DeserializeOwned + Serialize;
|
||||||
|
|
||||||
/// The type of the event's `unsigned` field.
|
/// The type of the event's `unsigned` field.
|
||||||
type Unsigned: Clone + fmt::Debug + Default + CanBeEmpty + StateUnsignedFromParts + Serialize;
|
type Unsigned: Clone + fmt::Debug + Default + CanBeEmpty + StateUnsignedFromParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Content of a redacted state event.
|
/// Content of a redacted state event.
|
||||||
|
@ -496,7 +496,7 @@ impl StrippedRoomMemberEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extra information about a message event that is not incorporated into the event's hash.
|
/// Extra information about a message event that is not incorporated into the event's hash.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct RoomMemberUnsigned {
|
pub struct RoomMemberUnsigned {
|
||||||
/// The time in milliseconds that has elapsed since the event was sent.
|
/// The time in milliseconds that has elapsed since the event was sent.
|
||||||
@ -504,26 +504,23 @@ pub struct RoomMemberUnsigned {
|
|||||||
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
||||||
/// at least one of the two servers is out of sync, which can cause the age to either be
|
/// at least one of the two servers is out of sync, which can cause the age to either be
|
||||||
/// negative or greater than it actually is.
|
/// negative or greater than it actually is.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub age: Option<Int>,
|
pub age: Option<Int>,
|
||||||
|
|
||||||
/// The client-supplied transaction ID, if the client being given the event is the same one
|
/// The client-supplied transaction ID, if the client being given the event is the same one
|
||||||
/// which sent it.
|
/// which sent it.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub transaction_id: Option<OwnedTransactionId>,
|
pub transaction_id: Option<OwnedTransactionId>,
|
||||||
|
|
||||||
/// Optional previous content of the event.
|
/// Optional previous content of the event.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub prev_content: Option<RoomMemberEventContent>,
|
pub prev_content: Option<RoomMemberEventContent>,
|
||||||
|
|
||||||
/// State events to assist the receiver in identifying the room.
|
/// State events to assist the receiver in identifying the room.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default)]
|
||||||
pub invite_room_state: Vec<Raw<AnyStrippedStateEvent>>,
|
pub invite_room_state: Vec<Raw<AnyStrippedStateEvent>>,
|
||||||
|
|
||||||
/// [Bundled aggregations] of related child events.
|
/// [Bundled aggregations] of related child events.
|
||||||
///
|
///
|
||||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||||
#[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")]
|
#[serde(rename = "m.relations", default)]
|
||||||
pub relations: BundledRelations,
|
pub relations: BundledRelations,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use js_int::Int;
|
use js_int::Int;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
|
use serde_json::{from_str as from_json_str, value::RawValue as RawJsonValue};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
@ -11,7 +11,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Extra information about a message event that is not incorporated into the event's hash.
|
/// Extra information about a message event that is not incorporated into the event's hash.
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct MessageLikeUnsigned {
|
pub struct MessageLikeUnsigned {
|
||||||
/// The time in milliseconds that has elapsed since the event was sent.
|
/// The time in milliseconds that has elapsed since the event was sent.
|
||||||
@ -19,18 +19,16 @@ pub struct MessageLikeUnsigned {
|
|||||||
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
||||||
/// at least one of the two servers is out of sync, which can cause the age to either be
|
/// at least one of the two servers is out of sync, which can cause the age to either be
|
||||||
/// negative or greater than it actually is.
|
/// negative or greater than it actually is.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub age: Option<Int>,
|
pub age: Option<Int>,
|
||||||
|
|
||||||
/// The client-supplied transaction ID, if the client being given the event is the same one
|
/// The client-supplied transaction ID, if the client being given the event is the same one
|
||||||
/// which sent it.
|
/// which sent it.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub transaction_id: Option<OwnedTransactionId>,
|
pub transaction_id: Option<OwnedTransactionId>,
|
||||||
|
|
||||||
/// [Bundled aggregations] of related child events.
|
/// [Bundled aggregations] of related child events.
|
||||||
///
|
///
|
||||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||||
#[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")]
|
#[serde(rename = "m.relations", default)]
|
||||||
pub relations: BundledRelations,
|
pub relations: BundledRelations,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +51,7 @@ impl CanBeEmpty for MessageLikeUnsigned {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Extra information about a state event that is not incorporated into the event's hash.
|
/// Extra information about a state event that is not incorporated into the event's hash.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct StateUnsigned<C: StateEventContent> {
|
pub struct StateUnsigned<C: StateEventContent> {
|
||||||
/// The time in milliseconds that has elapsed since the event was sent.
|
/// The time in milliseconds that has elapsed since the event was sent.
|
||||||
@ -61,22 +59,19 @@ pub struct StateUnsigned<C: StateEventContent> {
|
|||||||
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
/// This field is generated by the local homeserver, and may be incorrect if the local time on
|
||||||
/// at least one of the two servers is out of sync, which can cause the age to either be
|
/// at least one of the two servers is out of sync, which can cause the age to either be
|
||||||
/// negative or greater than it actually is.
|
/// negative or greater than it actually is.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub age: Option<Int>,
|
pub age: Option<Int>,
|
||||||
|
|
||||||
/// The client-supplied transaction ID, if the client being given the event is the same one
|
/// The client-supplied transaction ID, if the client being given the event is the same one
|
||||||
/// which sent it.
|
/// which sent it.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub transaction_id: Option<OwnedTransactionId>,
|
pub transaction_id: Option<OwnedTransactionId>,
|
||||||
|
|
||||||
/// Optional previous content of the event.
|
/// Optional previous content of the event.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub prev_content: Option<C>,
|
pub prev_content: Option<C>,
|
||||||
|
|
||||||
/// [Bundled aggregations] of related child events.
|
/// [Bundled aggregations] of related child events.
|
||||||
///
|
///
|
||||||
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
/// [Bundled aggregations]: https://spec.matrix.org/v1.4/client-server-api/#aggregations
|
||||||
#[serde(rename = "m.relations", default, skip_serializing_if = "BundledRelations::is_empty")]
|
#[serde(rename = "m.relations", default)]
|
||||||
pub relations: BundledRelations,
|
pub relations: BundledRelations,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user