cloneable_new

Function cloneable_new 

Source
pub fn cloneable_new<P: RefCountedPointer, T>(value: T) -> P::CloneableOf<T>
where P::CloneableOf<T>: Sized,
Expand description

Wraps a sized value in a cloneable pointer.

§Type Signature

forall p a. RefCountedPointer p => a -> RefCountedPointer a

§Type Parameters

  • P: The pointer brand.
  • T: The type of the value to wrap.

§Parameters

  • value: The value to wrap.

§Returns

The value wrapped in the cloneable pointer type.

§Examples

use fp_library::{brands::*, classes::*, functions::*};

let ptr = ref_counted_pointer_new::<RcBrand, _>(42);
let clone = ptr.clone();
assert_eq!(*clone, 42);