logo
#[repr(transparent)]
pub struct RacyCell<T>(_);
Expand description

Internal replacement for static mut T

Used to represent RTIC Resources

Soundness:

  1. Unsafe API for internal use only

  2. get_mut(&self) -> *mut T returns a raw mutable pointer to the inner T casting to &mut T is under control of RTIC RTIC ensures &mut T to be unique under Rust aliasing rules.

    Implementation uses the underlying UnsafeCell<T> self.0.get() -> *mut T

  3. get(&self) -> *const T returns a raw immutable (const) pointer to the inner T casting to &T is under control of RTIC RTIC ensures &T to be shared under Rust aliasing rules.

    Implementation uses the underlying UnsafeCell<T> self.0.get() -> *mut T, demoted to *const T

Implementations

Create a RacyCell

Get *mut T

Safety

See documentation notes for RacyCell

Get *const T

Safety

See documentation notes for RacyCell

Trait Implementations

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.