Skip to main content

SendRefPointed

Trait SendRefPointed 

Source
pub trait SendRefPointed: Kind_cdc7cd43dac7585f {
    // Required method
    fn send_ref_pure<'a, A: Clone + Send + Sync + 'a>(
        a: &A,
    ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>;
}
Expand description

A type class for injecting a value into a context from a reference, with Send + Sync bounds.

This is the thread-safe counterpart of RefPointed.

Required Methods§

Source

fn send_ref_pure<'a, A: Clone + Send + Sync + 'a>( a: &A, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>

Wraps a cloned value in a new thread-safe memoized context.

§Type Signature

forall A. &A -> Self A

§Type Parameters
  • 'a: The lifetime of the value.
  • A: The type of the value. Must be Clone + Send + Sync.
§Parameters
  • a: A reference to the value to wrap.
§Returns

A new thread-safe memoized value containing a clone of the input.

§Examples
use fp_library::{
	brands::*,
	classes::*,
	types::*,
};

let value = 42;
let lazy = LazyBrand::<ArcLazyConfig>::send_ref_pure(&value);
assert_eq!(*lazy.evaluate(), 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.

Implementors§