From 9d345244426e01f1c88fcbc30f71e04d20cb5e73 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Wed, 9 Jun 2021 20:24:01 +0200 Subject: [PATCH] common: Add instance-id field to ProtocolInstance It's not included in the specs. See https://github.com/matrix-org/matrix-doc/issues/3203 --- crates/ruma-common/src/thirdparty.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/ruma-common/src/thirdparty.rs b/crates/ruma-common/src/thirdparty.rs index 4eee803f..90a8276e 100644 --- a/crates/ruma-common/src/thirdparty.rs +++ b/crates/ruma-common/src/thirdparty.rs @@ -85,6 +85,10 @@ pub struct ProtocolInstance { /// A unique identifier across all instances. 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`. @@ -101,12 +105,29 @@ pub struct ProtocolInstanceInit { /// A unique identifier across all instances. pub network_id: String, + + /// A unique identifier across all instances. + #[cfg(feature = "unstable-pre-spec")] + pub instance_id: String, } impl From for ProtocolInstance { fn from(init: ProtocolInstanceInit) -> Self { - let ProtocolInstanceInit { desc, fields, network_id } = init; - Self { desc, icon: None, fields, network_id } + let ProtocolInstanceInit { + 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, + } } }