Box rarely-used variants to reduce enum stack size

This commit is contained in:
Jonas Platte 2022-12-15 11:26:57 +01:00 committed by Jonas Platte
parent a22033413d
commit 67cc8e9e9c
2 changed files with 5 additions and 3 deletions

View File

@ -73,7 +73,7 @@ pub mod v3 {
/// Custom login type.
#[doc(hidden)]
_Custom(CustomLoginType),
_Custom(Box<CustomLoginType>),
}
impl LoginType {
@ -91,7 +91,9 @@ pub mod v3 {
"m.login.password" => Self::Password(from_json_object(data)?),
"m.login.token" => Self::Token(from_json_object(data)?),
"m.login.sso" => Self::Sso(from_json_object(data)?),
_ => Self::_Custom(CustomLoginType { type_: login_type.to_owned(), data }),
_ => {
Self::_Custom(Box::new(CustomLoginType { type_: login_type.to_owned(), data }))
}
})
}

View File

@ -180,7 +180,7 @@ pub enum AllowRule {
RoomMembership(RoomMembership),
#[doc(hidden)]
_Custom(CustomAllowRule),
_Custom(Box<CustomAllowRule>),
}
impl AllowRule {