pub trait SendRefCountedPointer: RefCountedPointer {
type SendOf<'a, T: ?Sized + Send + Sync + 'a>: Clone + Send + Sync + Deref<Target = T> + 'a;
// Required method
fn send_new<'a, T: Send + Sync + 'a>(value: T) -> Self::SendOf<'a, T>
where Self::SendOf<'a, 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<'a, T: Send + Sync + 'a>(value: T) -> Self::SendOf<'a, T>
fn send_new<'a, T: Send + Sync + 'a>(value: T) -> Self::SendOf<'a, T>
Wraps a sized value in a thread-safe pointer.
§Type Signature
forall T. T -> Self T
§Type Parameters
'a: 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);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.