common: Add instance-id field to ProtocolInstance

It's not included in the specs.
See https://github.com/matrix-org/matrix-doc/issues/3203
This commit is contained in:
Julian Sparber 2021-06-09 20:24:01 +02:00 committed by Jonas Platte
parent 76118b0ee2
commit 9d34524442

View File

@ -85,6 +85,10 @@ pub struct ProtocolInstance {
/// A unique identifier across all instances. /// A unique identifier across all instances.
pub network_id: String, pub network_id: String,
/// A unique identifier across all instances.
#[cfg(feature = "unstable-pre-spec")]
pub instance_id: String,
} }
/// Initial set of fields of `Protocol`. /// Initial set of fields of `Protocol`.
@ -101,12 +105,29 @@ pub struct ProtocolInstanceInit {
/// A unique identifier across all instances. /// A unique identifier across all instances.
pub network_id: String, pub network_id: String,
/// A unique identifier across all instances.
#[cfg(feature = "unstable-pre-spec")]
pub instance_id: String,
} }
impl From<ProtocolInstanceInit> for ProtocolInstance { impl From<ProtocolInstanceInit> for ProtocolInstance {
fn from(init: ProtocolInstanceInit) -> Self { fn from(init: ProtocolInstanceInit) -> Self {
let ProtocolInstanceInit { desc, fields, network_id } = init; let ProtocolInstanceInit {
Self { desc, icon: None, fields, network_id } desc,
fields,
network_id,
#[cfg(feature = "unstable-pre-spec")]
instance_id,
} = init;
Self {
desc,
icon: None,
fields,
network_id,
#[cfg(feature = "unstable-pre-spec")]
instance_id,
}
} }
} }