pub struct SafeCell<T> { /* private fields */ }
Expand description
The SafeCell
type.
See the module-level documentation for more information.
Implementations§
Source§impl<T> SafeCell<T>
impl<T> SafeCell<T>
Sourcepub fn get_mut(&mut self) -> &mut T
pub fn get_mut(&mut self) -> &mut T
Returns a mutable reference to the wrapped value.
Using this reference, the value can be safely mutated. Using the
type-level mechanism provided by exterior mutability, SafeCell
guarantees that no unsound concurrent access can occur.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Extracts and returns the wrapped value.
Note that this method must not be called concurrently, and once
into_inner
is called, references obtained by get
and get_mut
must no longer be used. This is statically ensured.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SafeCell<T>where
T: Freeze,
impl<T> RefUnwindSafe for SafeCell<T>where
T: RefUnwindSafe,
impl<T> Send for SafeCell<T>where
T: Send,
impl<T> Sync for SafeCell<T>where
T: Sync,
impl<T> Unpin for SafeCell<T>where
T: Unpin,
impl<T> UnwindSafe for SafeCell<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more