diff --git a/crates/ruma-appservice-api/src/lib.rs b/crates/ruma-appservice-api/src/lib.rs index 9dae5fa5..eab30c95 100644 --- a/crates/ruma-appservice-api/src/lib.rs +++ b/crates/ruma-appservice-api/src/lib.rs @@ -103,6 +103,7 @@ pub struct Registration { /// /// Used for [appservice registration](https://matrix.org/docs/spec/application_service/r0.1.2#registration). #[derive(Debug)] +#[allow(clippy::exhaustive_structs)] pub struct RegistrationInit { /// A unique, user - defined ID of the application service which will never change. pub id: String, diff --git a/crates/ruma-identity-service-api/src/tos/get_terms_of_service/v2.rs b/crates/ruma-identity-service-api/src/tos/get_terms_of_service/v2.rs index 577be3cf..28eff315 100644 --- a/crates/ruma-identity-service-api/src/tos/get_terms_of_service/v2.rs +++ b/crates/ruma-identity-service-api/src/tos/get_terms_of_service/v2.rs @@ -42,6 +42,7 @@ impl Response { /// Collection of localized policies. #[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct Policies { /// The version for the policy. /// @@ -57,8 +58,16 @@ pub struct Policies { pub localized: BTreeMap, } +impl Policies { + /// Create a new `Policies` with the given version and localized map. + pub fn new(version: String, localized: BTreeMap) -> Self { + Self { version, localized } + } +} + /// A localized policy offered by a server. #[derive(Clone, Debug, Serialize, Deserialize)] +#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct LocalizedPolicy { /// The localized name of the policy. /// @@ -71,3 +80,10 @@ pub struct LocalizedPolicy { /// and `https://example.org/somewhere/terms-2.0-fr.html`. pub url: String, } + +impl LocalizedPolicy { + /// Create a new `LocalizedPolicy` with the given name and url. + pub fn new(name: String, url: String) -> Self { + Self { name, url } + } +}