Skip to main content

Slot

Trait Slot 

Source
pub trait Slot<T>: Sized {
    // Required methods
    fn of(collection: T) -> Self;
    fn inner(&self) -> &T;
    fn inner_mut(&mut self) -> &mut T;
    fn into_inner(self) -> T;
}
Expand description

What holds a collection of type T in a Lean object: the collection itself, or an Arc of it. An Arc is shared by a pointer, so that a collection kept in two places, or read out of another collection, is not copied; one of two holders that changes it gets a copy of its own first, which is what Lean does with a value it holds twice.

Required Methods§

Source

fn of(collection: T) -> Self

Source

fn inner(&self) -> &T

Source

fn inner_mut(&mut self) -> &mut T

The collection for changing, which is this holder’s alone afterwards.

Source

fn into_inner(self) -> T

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Clone> Slot<T> for Arc<T>

Source§

fn of(collection: T) -> Arc<T> ⓘ

Source§

fn inner(&self) -> &T

Source§

fn inner_mut(&mut self) -> &mut T

Source§

fn into_inner(self) -> T

Implementors§

Source§

impl<T> Slot<T> for T