pub trait ToBindingValue {
// Required method
fn to_binding_value(&self) -> BindingValue;
}Expand description
Trait for converting types to BindingValue
This trait is implemented for common Rust types to allow them to be used in binding expressions.
§Example
use dampen_core::{ToBindingValue, BindingValue};
let val = 42i32.to_binding_value();
assert_eq!(val, BindingValue::Integer(42));Required Methods§
Sourcefn to_binding_value(&self) -> BindingValue
fn to_binding_value(&self) -> BindingValue
Convert self to a BindingValue
Implementations on Foreign Types§
Source§impl ToBindingValue for &str
Convert &str to BindingValue::String
impl ToBindingValue for &str
Convert &str to BindingValue::String
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for bool
Convert bool to BindingValue::Bool
impl ToBindingValue for bool
Convert bool to BindingValue::Bool
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for f32
Convert f32 to BindingValue::Float
impl ToBindingValue for f32
Convert f32 to BindingValue::Float
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for f64
Convert f64 to BindingValue::Float
impl ToBindingValue for f64
Convert f64 to BindingValue::Float
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for i32
Convert i32 to BindingValue::Integer
impl ToBindingValue for i32
Convert i32 to BindingValue::Integer
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for i64
Convert i64 to BindingValue::Integer
impl ToBindingValue for i64
Convert i64 to BindingValue::Integer
fn to_binding_value(&self) -> BindingValue
Source§impl ToBindingValue for String
Convert String to BindingValue::String
impl ToBindingValue for String
Convert String to BindingValue::String
fn to_binding_value(&self) -> BindingValue
Source§impl<T: ToBindingValue> ToBindingValue for Option<T>
Convert Option<T> to BindingValue or BindingValue::None
impl<T: ToBindingValue> ToBindingValue for Option<T>
Convert Option<T> to BindingValue or BindingValue::None
fn to_binding_value(&self) -> BindingValue
Source§impl<T: ToBindingValue> ToBindingValue for Vec<T>
Convert Vec<T> to BindingValue::List
impl<T: ToBindingValue> ToBindingValue for Vec<T>
Convert Vec<T> to BindingValue::List
fn to_binding_value(&self) -> BindingValue
Source§impl<T: ToBindingValue> ToBindingValue for HashMap<String, T>
Convert HashMap<String, T> to BindingValue::Object
impl<T: ToBindingValue> ToBindingValue for HashMap<String, T>
Convert HashMap<String, T> to BindingValue::Object