Add Freeze::clone
This commit is contained in:
parent
f49382c050
commit
c83eba9251
2 changed files with 12 additions and 8 deletions
|
@ -45,6 +45,16 @@ impl<T> FreezeLock<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Clones the inner value along with the frozen state.
|
||||
#[inline]
|
||||
pub fn clone(&self) -> Self
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
let lock = self.read();
|
||||
Self::with(lock.clone(), self.is_frozen())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_frozen(&self) -> bool {
|
||||
self.frozen.load(Ordering::Acquire)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue