Skip to main content

send_new

Function send_new 

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

Wraps a sized value in a thread-safe pointer.

§Type Signature

forall p a. (SendRefCountedPointer p, Send a) => a -> SendRefCountedPointer 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 thread-safe pointer type.

§Examples

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

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