new

Function new 

Source
pub fn new<Brand: ThunkWrapper, T>(value: Option<T>) -> Brand::Cell<T>
Expand description

Creates a new cell containing the value.

Free function version that dispatches to the type class’ associated function.

§Type Signature

forall a. Option a -> Cell a

§Type Parameters

  • Brand: The pointer brand.
  • T: The type of the value.

§Parameters

  • value: The value to wrap.

§Returns

A new cell containing the value.

§Examples

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

let cell = thunk_wrapper_new::<RcBrand, _>(Some(42));
assert_eq!(thunk_wrapper_take::<RcBrand, _>(&cell), Some(42));