Skip to main content

new

Function new 

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

Wraps a sized value in the pointer.

§Type Signature

forall P T. Pointer P => T -> P T

§Type Parameters

  • 'a: The pointer brand.
  • P: The lifetime of the value.
  • 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);