IdentifierExt

Trait IdentifierExt 

Source
pub trait IdentifierExt: Identifier {
    // Provided methods
    fn owns<V: ?Sized>(&self, cell: &IdCell<V, Self::Token>) -> bool { ... }
    fn cell<V>(&self, value: V) -> IdCell<V, Self::Token> { ... }
    fn get<'a, A: ?Sized>(&'a self, a: &'a IdCell<A, Self::Token>) -> &'a A { ... }
    fn get_mut<'a, A: ?Sized>(
        &'a mut self,
        a: &'a IdCell<A, Self::Token>,
    ) -> &'a mut A { ... }
    fn get_mut2<'a, A: ?Sized, B: ?Sized>(
        &'a mut self,
        a: &'a IdCell<A, Self::Token>,
        b: &'a IdCell<B, Self::Token>,
    ) -> (&'a mut A, &'a mut B) { ... }
    fn get_mut3<'a, A: ?Sized, B: ?Sized, C: ?Sized>(
        &'a mut self,
        a: &'a IdCell<A, Self::Token>,
        b: &'a IdCell<B, Self::Token>,
        c: &'a IdCell<C, Self::Token>,
    ) -> (&'a mut A, &'a mut B, &'a mut C) { ... }
    fn get_all_mut<'a, L>(&'a mut self, list: L) -> L::Output
       where L: GetAllMut<&'a mut Self> { ... }
    fn try_get_all_mut<'a, L>(&'a mut self, list: L) -> Option<L::Output>
       where L: GetAllMut<&'a mut Self> { ... }
    fn swap<V>(
        &mut self,
        a: &IdCell<V, Self::Token>,
        b: &IdCell<V, Self::Token>,
    ) { ... }
}
Expand description

An extension trait that provides functionality to get values out of IdCells safely. This trait is automatically implemented for any type that implements Identifier. So you just need to bring it into scope to use it.

Provided Methods§

Source

fn owns<V: ?Sized>(&self, cell: &IdCell<V, Self::Token>) -> bool

Returns true if this identifier owns the IdCell

Source

fn cell<V>(&self, value: V) -> IdCell<V, Self::Token>

Create a new cell that is owned by this identifer

Source

fn get<'a, A: ?Sized>(&'a self, a: &'a IdCell<A, Self::Token>) -> &'a A

Get a shared reference from the IdCell

§Panic

Will panic if self doesn’t own the IdCell

Source

fn get_mut<'a, A: ?Sized>( &'a mut self, a: &'a IdCell<A, Self::Token>, ) -> &'a mut A

Get a unique reference from the IdCell

§Panic

Will panic if self doesn’t own the IdCell

Source

fn get_mut2<'a, A: ?Sized, B: ?Sized>( &'a mut self, a: &'a IdCell<A, Self::Token>, b: &'a IdCell<B, Self::Token>, ) -> (&'a mut A, &'a mut B)

Get unique references both of the IdCells

§Panic

Will panic if self doesn’t own any of the IdCells or if either of the two IdCells overlap

Source

fn get_mut3<'a, A: ?Sized, B: ?Sized, C: ?Sized>( &'a mut self, a: &'a IdCell<A, Self::Token>, b: &'a IdCell<B, Self::Token>, c: &'a IdCell<C, Self::Token>, ) -> (&'a mut A, &'a mut B, &'a mut C)

Get unique references from all three of the IdCells

§Panic

Will panic if self doesn’t own any of the IdCells or if any of the three IdCells overlap

Source

fn get_all_mut<'a, L>(&'a mut self, list: L) -> L::Output
where L: GetAllMut<&'a mut Self>,

Get unique references from all of the IdCells

§Panic

Will panic if self doesn’t own any of the IdCells or if any of the three IdCells overlap

Source

fn try_get_all_mut<'a, L>(&'a mut self, list: L) -> Option<L::Output>
where L: GetAllMut<&'a mut Self>,

Tries to get unique references from all of the IdCells Returns None if any of the IdCells overlap

§Panic

Will panic if self doesn’t own any of the IdCells

Source

fn swap<V>(&mut self, a: &IdCell<V, Self::Token>, b: &IdCell<V, Self::Token>)

Swap two IdCells without uninitializing either one

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§