Trait conch_runtime::RefCounted [] [src]

pub trait RefCounted<T>: Sized + Clone + Deref<Target = T> + From<T> {
    fn get_mut(&mut self) -> Option<&mut T>;
fn make_mut(&mut self) -> &mut T
    where
        T: Clone
; }

A convenience trait to abstract over Arc and Rc APIs.

Required Methods

Returns a mutable reference to the contained value if the wrapper has a single, unique, reference.

Returns None if the Rc<T> is not unique.

Make a mutable reference into the given implementation. If the implementation has more than one strong reference, or any weak references, the inner data is cloned.

This is also referred to as a copy-on-write.

Implementations on Foreign Types

impl<T> RefCounted<T> for Rc<T>
[src]

[src]

[src]

impl<T> RefCounted<T> for Arc<T>
[src]

[src]

[src]

Implementors