computable 0.1.0

Computable real numbers with guaranteed correctness via interval refinement
Documentation
use std::sync::atomic::{AtomicBool, Ordering};

/// Monotonic stop flag that can only transition from false to true.
#[derive(Debug)]
pub struct StopFlag {
    inner: AtomicBool,
}

impl StopFlag {
    pub fn new() -> Self {
        Self {
            inner: AtomicBool::new(false),
        }
    }

    pub fn stop(&self) {
        self.inner.store(true, Ordering::Relaxed);
    }

    pub fn is_stopped(&self) -> bool {
        self.inner.load(Ordering::Relaxed)
    }
}