Skip to main content

Module ref_pointed

Module ref_pointed 

Source
Expand description

Contexts that can be initialized from a reference via the ref_pure operation.

Unlike Pointed::pure, which takes ownership of the value, ref_pure accepts a reference and clones the value to produce the context. This enables by-reference generic code to construct contexts without requiring ownership.

§Examples

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

let value = 42;
let lazy = LazyBrand::<RcLazyConfig>::ref_pure(&value);
assert_eq!(*lazy.evaluate(), 42);

Traits§

RefPointed
A type class for contexts that can be initialized from a reference.

Functions§

ref_pure
Wraps a cloned value in the context.