[][src]Struct pui_cell::IdCell

pub struct IdCell<V: ?Sized, T> {
    pub token: T,
    // some fields omitted
}

A thread-safe shared mutable type that can be allows references into it's interior (unlike Cell) without returning guards (unlike RefCell, Mutex, or RwLock).

Fields

token: T

The token that identifies this IdCell

Implementations

impl<V, T: Trivial> IdCell<V, T>[src]

pub fn new(value: V) -> Self[src]

Create a new IdCell

impl<V, T> IdCell<V, T>[src]

pub const fn with_token(value: V, token: T) -> Self[src]

Create a new IdCell with the given token

pub fn into_raw_parts(self) -> (V, T)[src]

Decompose the given IdCell into a value-token pair

impl<V: ?Sized, T> IdCell<V, T>[src]

pub fn as_ptr(&self) -> *mut V[src]

Get a pointer into the interior of the IdCell

pub fn get_mut(&mut self) -> &mut V[src]

Get a mutable reference into the interior of the IdCell

impl<V: ?Sized, T: Trivial> IdCell<V, T>[src]

pub fn from_mut(value: &mut V) -> &mut Self[src]

Create a new IdCell from a reference to a given type

Note: this requires the token have the same layout as () and be Trivial. The Trivial requirement is handled by traits, but if you try and call this with a token that has a different layout from (), from_mut this will panic.

impl<V, T: Trivial> IdCell<[V], T>[src]

pub fn as_slice_of_cells(&self) -> &[IdCell<V, T>][src]

Convert a cell of a slice to a slice of cells

Note: this requires the token have the same layout as () and be Trivial. The Trivial requirement is handled by traits, but if you try and call this with a token that has a different layout from (), as_slice_of_cells this will panic.

pub fn as_slice_of_cells_mut(&mut self) -> &mut [IdCell<V, T>][src]

Convert a cell of a slice to a slice of cells

Note: this requires the token have the same layout as () and be Trivial. The Trivial requirement is handled by traits, but if you try and call this with a token that has a different layout from (), as_slice_of_cells_mut this will panic.

Auto Trait Implementations

impl<V: ?Sized, T> Send for IdCell<V, T> where
    T: Send,
    V: Send
[src]

impl<V, T> Sync for IdCell<V, T> where
    T: Sync,
    V: Send + Sync
[src]

impl<V: ?Sized, T> Unpin for IdCell<V, T> where
    T: Unpin,
    V: Unpin
[src]

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<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.