Trait wagon_value::ToValue

source ·
pub trait ToValue<T: Valueable> {
    // Required method
    fn to_value(&self) -> &Value<T>;
}
Expand description

A second trait for “extension” of the Value enum.

This is intended to “extract” the inner value if possible and makes automatic implementation of Valueable possible. If your type properly wraps Value (as in, it implements ToValue, From<Value<Self>> and all the expected operations), Valueable is automatically implemented by simply taking the value returned by ToValue::to_value and using that implementation. If you do not desire this behaviour, do not implement ToValue.

Required Methods§

source

fn to_value(&self) -> &Value<T>

Return a reference to the Value that this type encompasses.

Implementors§