app/identity: Make all pub structs non_exhaustive
This commit is contained in:
parent
757ab5273c
commit
5d0803f63d
@ -103,6 +103,7 @@ pub struct Registration {
|
|||||||
///
|
///
|
||||||
/// Used for [appservice registration](https://matrix.org/docs/spec/application_service/r0.1.2#registration).
|
/// Used for [appservice registration](https://matrix.org/docs/spec/application_service/r0.1.2#registration).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[allow(clippy::exhaustive_structs)]
|
||||||
pub struct RegistrationInit {
|
pub struct RegistrationInit {
|
||||||
/// A unique, user - defined ID of the application service which will never change.
|
/// A unique, user - defined ID of the application service which will never change.
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
@ -42,6 +42,7 @@ impl Response {
|
|||||||
|
|
||||||
/// Collection of localized policies.
|
/// Collection of localized policies.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct Policies {
|
pub struct Policies {
|
||||||
/// The version for the policy.
|
/// The version for the policy.
|
||||||
///
|
///
|
||||||
@ -57,8 +58,16 @@ pub struct Policies {
|
|||||||
pub localized: BTreeMap<String, LocalizedPolicy>,
|
pub localized: BTreeMap<String, LocalizedPolicy>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Policies {
|
||||||
|
/// Create a new `Policies` with the given version and localized map.
|
||||||
|
pub fn new(version: String, localized: BTreeMap<String, LocalizedPolicy>) -> Self {
|
||||||
|
Self { version, localized }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A localized policy offered by a server.
|
/// A localized policy offered by a server.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct LocalizedPolicy {
|
pub struct LocalizedPolicy {
|
||||||
/// The localized name of the policy.
|
/// The localized name of the policy.
|
||||||
///
|
///
|
||||||
@ -71,3 +80,10 @@ pub struct LocalizedPolicy {
|
|||||||
/// and `https://example.org/somewhere/terms-2.0-fr.html`.
|
/// and `https://example.org/somewhere/terms-2.0-fr.html`.
|
||||||
pub url: String,
|
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 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user