pub trait LazyValueFn<V: Value>: Copy {
const LAZY_VALUE_FN: fn() -> &'static dyn Value = _;
// Required method
fn generate_value() -> &'static V;
}
Expand description
Trait that helps us convert a fn() -> &'static impl Value
to a fn() -> &'static dyn Value
.
For creating a type that implements LazyValueFn
see the lazy_value
macro.
Note: Ideally we could use const generics to pass a function pointer directly to
VarDefinition::new
, but Rust doesn’t currently support this.
Provided Associated Constants§
const LAZY_VALUE_FN: fn() -> &'static dyn Value = _
Required Methods§
fn generate_value() -> &'static V
Object Safety§
This trait is not object safe.