use crate::sync_types::sync::atomic::AtomicBool;
use crate::sync_types::sync::Arc;
#[derive(Debug, Clone)]
pub enum PartitionMode {
Exclusive { in_use: Arc<AtomicBool> },
Concurrent,
}
impl PartitionMode {
pub fn with_exclusive_access() -> PartitionMode {
PartitionMode::Exclusive {
in_use: Default::default(),
}
}
pub fn with_concurrent_access() -> PartitionMode {
PartitionMode::Concurrent
}
}
#[derive(Debug)]
pub struct Exclusive {
pub(crate) in_use: Arc<AtomicBool>,
}
#[derive(Debug, Clone)]
pub struct Concurrent;
trait Sealed {}
impl Sealed for Exclusive {}
impl Sealed for Concurrent {}
#[allow(private_bounds)]
pub trait PartitionModeT: Sealed {}
impl<T> PartitionModeT for T where T: Sealed {}