mz_sql::session::vars::polyfill

Trait LazyValueFn

Source
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§

Source

const LAZY_VALUE_FN: fn() -> &'static dyn Value = _

Required Methods§

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§