common: Derive Default for (Incoming)RoomNetwork

This commit is contained in:
Jonas Platte 2022-11-14 14:24:38 +01:00
parent ed100afddb
commit 0a56dfb46e
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C

View File

@ -141,11 +141,12 @@ impl Filter<'_> {
/// Information about which networks/protocols from application services on the /// Information about which networks/protocols from application services on the
/// homeserver from which to request rooms. /// homeserver from which to request rooms.
#[derive(Clone, Debug, PartialEq, Eq, Incoming)] #[derive(Clone, Debug, Default, PartialEq, Eq, Incoming)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[incoming_derive(Clone, PartialEq, Eq, !Deserialize)] #[incoming_derive(Clone, Default, PartialEq, Eq, !Deserialize)]
pub enum RoomNetwork<'a> { pub enum RoomNetwork<'a> {
/// Return rooms from the Matrix network. /// Return rooms from the Matrix network.
#[default]
Matrix, Matrix,
/// Return rooms from all the networks/protocols the homeserver knows about. /// Return rooms from all the networks/protocols the homeserver knows about.
@ -155,12 +156,6 @@ pub enum RoomNetwork<'a> {
ThirdParty(&'a str), ThirdParty(&'a str),
} }
impl<'a> Default for RoomNetwork<'a> {
fn default() -> Self {
RoomNetwork::Matrix
}
}
/// The rule used for users wishing to join a public room. /// The rule used for users wishing to join a public room.
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
#[derive(Clone, Debug, Default, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, Default, PartialEq, Eq, StringEnum)]