pragma_sync 1.0.0

pragma.core L1: low-level synchronization primitives (the only crate allowed to use unsafe)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Errors of the synchronization primitives.
///
/// ```
/// use pragma_sync::{AtomicCounter, SyncError};
///
/// let full = AtomicCounter::new(usize::MAX);
/// assert_eq!(full.increment(), Err(SyncError::CounterOverflow));
/// assert_eq!(full.get(), usize::MAX); // the value is left as it was
/// ```
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum SyncError {
    /// The [`AtomicCounter`](crate::AtomicCounter) reached `usize::MAX`.
    #[error("atomic counter overflow")]
    CounterOverflow,
}