push: Add convenience method to check if an action is a highlight tweak

This commit is contained in:
Kévin Commaille 2023-03-13 13:36:56 +01:00
parent 03a58bcd88
commit b6717bc2ea
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C

View File

@ -30,6 +30,13 @@ pub enum Action {
_Custom(CustomAction),
}
impl Action {
/// Whether this action is an `Action::SetTweak(Tweak::Highlight(true))`.
pub fn is_highlight(&self) -> bool {
matches!(self, Action::SetTweak(Tweak::Highlight(true)))
}
}
/// The `set_tweak` action.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]