use crate::geom::{Offset, Rect};
pub use IsUsed::{Unused, Used};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum IsUsed {
Unused,
Used,
}
impl From<bool> for IsUsed {
fn from(is_used: bool) -> Self {
match is_used {
false => Self::Unused,
true => Self::Used,
}
}
}
impl From<IsUsed> for bool {
fn from(is_used: IsUsed) -> bool {
is_used == Used
}
}
impl std::ops::BitOr for IsUsed {
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self {
match (self, rhs) {
(Unused, Unused) => Unused,
_ => Used,
}
}
}
impl std::ops::BitOrAssign for IsUsed {
#[inline]
fn bitor_assign(&mut self, rhs: Self) {
*self = *self | rhs;
}
}
impl std::ops::Not for IsUsed {
type Output = bool;
#[inline]
fn not(self) -> bool {
self != Used
}
}
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
#[must_use]
pub enum Scroll {
#[default]
None,
Scrolled,
Offset(Offset),
Rect(Rect),
}