orx_concurrent_option/
states.rsuse core::sync::atomic::Ordering;
pub type StateU8 = u8;
pub const ORDER_LOAD: Ordering = Ordering::Acquire;
pub const ORDER_STORE: Ordering = Ordering::SeqCst;
pub const NONE: StateU8 = 0;
pub const RESERVED: StateU8 = 1;
pub const SOME: StateU8 = 2;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum State {
None,
Some,
Reserved,
}
impl State {
#[allow(clippy::panic, clippy::missing_panics_doc)]
pub(crate) fn new(state: StateU8) -> Self {
match state {
NONE => Self::None,
SOME => Self::Some,
RESERVED => Self::Reserved,
_ => panic!("should be either of the three valid states"),
}
}
}