kaspa-utils 0.15.0

Kaspa utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::sync::Arc;

pub trait ArcExtensions<T> {
    fn unwrap_or_clone(self) -> T;
}

impl<T: Clone> ArcExtensions<T> for Arc<T> {
    fn unwrap_or_clone(self) -> T {
        // Copy of Arc::unwrap_or_clone from unstable rust
        Arc::try_unwrap(self).unwrap_or_else(|arc| (*arc).clone())
    }
}