Trait tau_engine::AsValue [−][src]
Expand description
A data type that can be represented as a Value
.
Implementations
As long as the data type can be coerced into one of the values provided by Value
then
AsValue
can be implemented on that type. Below is a contrived example:
use std::borrow::Cow; use tau_engine::{AsValue, Value}; enum Foo { Bar, Baz } impl AsValue for Foo { fn as_value(&self) -> Value<'_> { match self { Self::Bar => Value::String(Cow::Borrowed("bar")), Self::Baz => Value::String(Cow::Borrowed("baz")), } } }