Trait Shared

Source
pub trait Shared<A> {
    // Required method
    fn shared(self) -> Arc<A>;
}
Expand description

§Automatic Arc wrapping

The Shared trait provides automatic wrapping for things which take Arcs, meaning that anything which takes an argument of type Shared<A> will accept either an A or an Arc<A>.

Because everything stored in im’s persistent data structures is wrapped in Arcs, Shared makes you have to worry less about whether what you’ve got is an A or an Arc<A> or a reference to such - the compiler will just figure it out for you, which is as it should be.

Required Methods§

Source

fn shared(self) -> Arc<A>

Get a new Arc pointer for this value

Implementations on Foreign Types§

Source§

impl<'a, A> Shared<A> for &'a Arc<A>

Source§

fn shared(self) -> Arc<A>

Source§

impl<'a, A> Shared<A> for &'a A
where A: Clone,

Source§

fn shared(self) -> Arc<A>

Source§

impl<A> Shared<A> for Arc<A>

Source§

fn shared(self) -> Arc<A>

Implementors§

Source§

impl<A> Shared<A> for A