Skip to main content

send_new

Function send_new 

Source
pub fn send_new<'a, P: SendRefCountedPointer, T: Send + Sync + 'a>(
    value: T,
) -> P::SendOf<'a, T>
where P::SendOf<'a, T>: Sized,
Expand description

Wraps a sized value in a thread-safe pointer.

§Type Signature

forall P T. SendRefCountedPointer 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 thread-safe pointer type.

§Examples

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

let ptr = send_ref_counted_pointer_new::<ArcBrand, _>(42);
assert_eq!(*ptr, 42);