jorendorff / atomicbox

Safe atomic Box types for Rust
Other
22 stars 11 forks source link

Add is_some method to AtomicOptionBox. #12

Open charles-r-earp opened 1 year ago

charles-r-earp commented 1 year ago

Consider adding something like this:

impl<T> AtomicOptionBox<T> {
    pub fn is_some(&self, ordering: Ordering) -> bool;
}

It would be helpful for checking whether the box has a value without taking it. A simple use case is just for implementing Debug without exposing the box itself. Also for implementing channels and other concurrent structures.