Struct loom::cell::UnsafeCell [−][src]
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
impl<T> UnsafeCell<T>
[src]
pub fn new(data: T) -> UnsafeCell<T>
[src]
Constructs a new instance of UnsafeCell
which will wrap the specified value.
pub fn with<F, R>(&self, f: F) -> R where
F: FnOnce(*const T) -> R,
[src]
F: FnOnce(*const T) -> R,
Get an immutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
pub fn with_mut<F, R>(&self, f: F) -> R where
F: FnOnce(*mut T) -> R,
[src]
F: FnOnce(*mut T) -> R,
Get a mutable pointer to the wrapped value.
Panics
This function will panic if the access is not valid under the Rust memory model.
Trait Implementations
impl<T: Debug> Debug for UnsafeCell<T>
[src]
impl<T: Default> Default for UnsafeCell<T>
[src]
fn default() -> UnsafeCell<T>
[src]
impl<T> From<T> for UnsafeCell<T>
[src]
fn from(src: T) -> UnsafeCell<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for UnsafeCell<T>
impl<T> Send for UnsafeCell<T> where
T: Send,
T: Send,
impl<T> !Sync for UnsafeCell<T>
impl<T> Unpin for UnsafeCell<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for UnsafeCell<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,