Skip to main content

new

Function new 

Source
pub fn new<P: Pointer, T>(value: T) -> P::Of<T>
where P::Of<T>: Sized,
Expand description

Wraps a sized value in the pointer.

§Type Signature

forall p a. Pointer p => a -> Pointer 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 pointer type.

§Examples

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

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