Git Panel: separate new and changed (#24181)
Release Notes: - N/A --------- Co-authored-by: conrad <conrad@zed.dev> Co-authored-by: nate <nate@zed.dev>
This commit is contained in:
co-authored by
conrad
nate
parent
6659aea13b
commit
71f2cbe798
@@ -29,6 +29,23 @@ impl ToggleState {
|
||||
Self::Selected => Self::Unselected,
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a `ToggleState` from the given `any_checked` and `all_checked` flags.
|
||||
pub fn from_any_and_all(any_checked: bool, all_checked: bool) -> Self {
|
||||
match (any_checked, all_checked) {
|
||||
(true, true) => Self::Selected,
|
||||
(false, false) => Self::Unselected,
|
||||
_ => Self::Indeterminate,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether this toggle state is selected
|
||||
pub fn selected(&self) -> bool {
|
||||
match self {
|
||||
ToggleState::Indeterminate | ToggleState::Unselected => false,
|
||||
ToggleState::Selected => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<bool> for ToggleState {
|
||||
|
||||
Reference in New Issue
Block a user