oni_comb_parser_rs/core/
committed_status.rs#[derive(Debug, Clone, PartialOrd, PartialEq)]
pub enum CommittedStatus {
Committed,
Uncommitted,
}
impl From<bool> for CommittedStatus {
fn from(value: bool) -> Self {
if value {
CommittedStatus::Committed
} else {
CommittedStatus::Uncommitted
}
}
}
impl CommittedStatus {
pub fn is_committed(&self) -> bool {
match self {
CommittedStatus::Committed => true,
CommittedStatus::Uncommitted => false,
}
}
pub fn is_uncommitted(&self) -> bool {
!self.is_committed()
}
pub fn or(&self, other: &Self) -> Self {
match (self, other) {
(CommittedStatus::Committed, _) => CommittedStatus::Committed,
(_, CommittedStatus::Committed) => CommittedStatus::Committed,
_ => CommittedStatus::Uncommitted,
}
}
}