pub trait SendRefCountedPointer: RefCountedPointer {
type SendOf<T: ?Sized + Send + Sync>: Clone + Send + Sync + Deref<Target = T>;
// Required method
fn send_new<T: Send + Sync>(value: T) -> Self::SendOf<T>
where Self::SendOf<T>: Sized;
}Expand description
Extension trait for thread-safe reference-counted pointers.
This follows the same pattern as SendCloneableFn extends CloneableFn,
adding a SendOf associated type with explicit Send + Sync bounds.
Required Associated Types§
Required Methods§
Sourcefn send_new<T: Send + Sync>(value: T) -> Self::SendOf<T>
fn send_new<T: Send + Sync>(value: T) -> Self::SendOf<T>
Wraps a sized value in a thread-safe pointer.
§Type Signature
forall a. Send a => a -> SendRefCountedPointer a
§Type Parameters
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);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.