Skip to main content

BindDescriptor

Trait BindDescriptor 

Source
pub trait BindDescriptor {
    type Event: EventDescriptor;
    type ValueTy: Into<JsValue> + Clone;

    const TARGET_PROPERTY: &'static str;
    const CONVERT_FROM_JS: for<'a> fn(&'a JsValue) -> Option<Self::ValueTy>;
}
Expand description

Description for a bind-able attribute/property.

Required Associated Constants§

Source

const TARGET_PROPERTY: &'static str

The name of the property to which we are binding.

Source

const CONVERT_FROM_JS: for<'a> fn(&'a JsValue) -> Option<Self::ValueTy>

Function for converting from JS to Rust type.

Required Associated Types§

Source

type Event: EventDescriptor

The event which we listen to to update the value.

Source

type ValueTy: Into<JsValue> + Clone

The value of the signal that drives the attribute/property.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl BindDescriptor for checked

Source§

const TARGET_PROPERTY: &'static str = "checked"

Source§

const CONVERT_FROM_JS: for<'a> fn(&'a JsValue) -> Option<Self::ValueTy> = JsValue::as_bool

Source§

type Event = change

Source§

type ValueTy = bool

Source§

impl BindDescriptor for value

Source§

const TARGET_PROPERTY: &'static str = "value"

Source§

const CONVERT_FROM_JS: for<'a> fn(&'a JsValue) -> Option<Self::ValueTy> = JsValue::as_string

Source§

type Event = input

Source§

type ValueTy = String

Source§

impl BindDescriptor for valueAsNumber

Source§

const TARGET_PROPERTY: &'static str = "valueAsNumber"

Source§

const CONVERT_FROM_JS: for<'a> fn(&'a JsValue) -> Option<Self::ValueTy> = JsValue::as_f64

Source§

type Event = input

Source§

type ValueTy = f64