impl DerefMut for Cell<[T]>

This commit is contained in:
F001 2018-06-07 17:47:55 +08:00
parent b1344abc58
commit 3eee486e27

View file

@ -559,6 +559,16 @@ impl<T> Deref for Cell<[T]> {
}
}
#[unstable(feature = "as_cell", issue="43038")]
impl<T> DerefMut for Cell<[T]> {
#[inline]
fn deref_mut(&mut self) -> &mut [Cell<T>] {
unsafe {
&mut *(self as *mut Cell<[T]> as *mut [Cell<T>])
}
}
}
/// A mutable memory location with dynamically checked borrow rules
///
/// See the [module-level documentation](index.html) for more.