#[derive(Clone, Copy, Debug)]
pub enum ConnectionState {
Closed,
Open,
}
impl ConnectionState {
#[inline]
pub const fn is_closed(self) -> bool {
matches!(self, Self::Closed)
}
#[inline]
pub const fn is_open(self) -> bool {
matches!(self, Self::Open)
}
}
impl From<bool> for ConnectionState {
#[inline]
fn from(from: bool) -> Self {
if from { Self::Open } else { Self::Closed }
}
}
impl From<ConnectionState> for bool {
#[inline]
fn from(from: ConnectionState) -> Self {
match from {
ConnectionState::Closed => false,
ConnectionState::Open => true,
}
}
}