From 92a35381b56ffa3c2a611287bb5011f574271478 Mon Sep 17 00:00:00 2001 From: Benjamin Lee Date: Sun, 15 Sep 2024 23:17:11 -0700 Subject: [PATCH] client-api: fix build when unstable-msc4168 feature is disabled (#1910) Without this feature, the v5 module does not exist. --- .../ruma-client-api/src/sync/sync_events/v4.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/ruma-client-api/src/sync/sync_events/v4.rs b/crates/ruma-client-api/src/sync/sync_events/v4.rs index 03cea5ef..677f1221 100644 --- a/crates/ruma-client-api/src/sync/sync_events/v4.rs +++ b/crates/ruma-client-api/src/sync/sync_events/v4.rs @@ -22,7 +22,9 @@ use ruma_events::{ }; use serde::{de::Error as _, Deserialize, Serialize}; -use super::{v5, DeviceLists, UnreadNotificationsCount}; +#[cfg(feature = "unstable-msc4186")] +use super::v5; +use super::{DeviceLists, UnreadNotificationsCount}; const METADATA: Metadata = metadata! { method: POST, @@ -927,6 +929,7 @@ impl Typing { } } +#[cfg(feature = "unstable-msc4186")] impl From for Request { fn from(value: v5::Request) -> Self { Self { @@ -951,6 +954,7 @@ impl From for Request { } } +#[cfg(feature = "unstable-msc4186")] impl From for SyncRequestList { fn from(value: v5::request::List) -> Self { Self { @@ -973,12 +977,14 @@ impl From for SyncRequestList { } } +#[cfg(feature = "unstable-msc4186")] impl From for RoomDetailsConfig { fn from(value: v5::request::RoomDetails) -> Self { Self { required_state: value.required_state, timeline_limit: value.timeline_limit } } } +#[cfg(feature = "unstable-msc4186")] impl From for SyncRequestListFilters { fn from(value: v5::request::ListFilters) -> Self { Self { @@ -989,6 +995,7 @@ impl From for SyncRequestListFilters { } } +#[cfg(feature = "unstable-msc4186")] impl From for RoomSubscription { fn from(value: v5::request::RoomSubscription) -> Self { Self { @@ -999,6 +1006,7 @@ impl From for RoomSubscription { } } +#[cfg(feature = "unstable-msc4186")] impl From for ExtensionsConfig { fn from(value: v5::request::Extensions) -> Self { Self { @@ -1013,6 +1021,7 @@ impl From for ExtensionsConfig { } } +#[cfg(feature = "unstable-msc4186")] impl From for ToDeviceConfig { fn from(value: v5::request::ToDevice) -> Self { Self { @@ -1025,18 +1034,21 @@ impl From for ToDeviceConfig { } } +#[cfg(feature = "unstable-msc4186")] impl From for E2EEConfig { fn from(value: v5::request::E2EE) -> Self { Self { enabled: value.enabled } } } +#[cfg(feature = "unstable-msc4186")] impl From for AccountDataConfig { fn from(value: v5::request::AccountData) -> Self { Self { enabled: value.enabled, lists: value.lists, rooms: value.rooms } } } +#[cfg(feature = "unstable-msc4186")] impl From for ReceiptsConfig { fn from(value: v5::request::Receipts) -> Self { Self { @@ -1047,6 +1059,7 @@ impl From for ReceiptsConfig { } } +#[cfg(feature = "unstable-msc4186")] impl From for RoomReceiptConfig { fn from(value: v5::request::ReceiptsRoom) -> Self { match value { @@ -1056,6 +1069,7 @@ impl From for RoomReceiptConfig { } } +#[cfg(feature = "unstable-msc4186")] impl From for TypingConfig { fn from(value: v5::request::Typing) -> Self { Self { enabled: value.enabled, lists: value.lists, rooms: value.rooms }