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

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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