Struct loom::cell::UnsafeCell[][src]

pub struct UnsafeCell<T> { /* fields omitted */ }

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]

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]

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]

impl<T> From<T> for UnsafeCell<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for UnsafeCell<T>

impl<T> Send for UnsafeCell<T> where
    T: Send

impl<T> !Sync for UnsafeCell<T>

impl<T> Unpin for UnsafeCell<T> where
    T: Unpin

impl<T> UnwindSafe for UnsafeCell<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.