Struct loom::cell::UnsafeCell [−][src]
pub struct UnsafeCell<T: ?Sized> { /* fields omitted */ }
Expand description
A checked version of std::cell::UnsafeCell
.
Instead of providing a get()
API, this version of UnsafeCell
provides
with
and with_mut
. Both functions take a closure in order to track the
start and end of the access to the underlying cell.
Implementations
Constructs a new instance of UnsafeCell
which will wrap the specified value.
Get an immutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
Get a mutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
Get an immutable pointer to the wrapped value.
This function returns a ConstPtr
guard, which is analogous to a
*const T
, but tracked by Loom. As long as the returned ConstPtr
exists, Loom will consider the cell to be accessed immutably.
This means that any mutable accesses (e.g. calls to with_mut
or
get_mut
) while the returned guard is live will result in a panic.
Panics
This function will panic if the access is not valid under the Rust memory model.
Get a mutable pointer to the wrapped value.
This function returns a MutPtr
guard, which is analogous to a
*mut T
, but tracked by Loom. As long as the returned MutPtr
exists, Loom will consider the cell to be accessed mutably.
This means that any concurrent mutable or immutable accesses (e.g. calls
to with
, with_mut
, get
, or get_mut
) while the returned
guard is live will result in a panic.
Panics
This function will panic if the access is not valid under the Rust memory model.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for UnsafeCell<T>
impl<T: ?Sized> Send for UnsafeCell<T> where
T: Send,
impl<T> !Sync for UnsafeCell<T>
impl<T: ?Sized> Unpin for UnsafeCell<T> where
T: Unpin,
impl<T: ?Sized> UnwindSafe for UnsafeCell<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more