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", so this trait is not object safe.

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> = {wasm_bindgen::JsValue::as_bool as for<'a> fn(&'a wasm_bindgen::JsValue) -> std::option::Option<<bind::checked as bind::BindDescriptor>::ValueTy>}

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> = {wasm_bindgen::JsValue::as_string as for<'a> fn(&'a wasm_bindgen::JsValue) -> std::option::Option<<bind::value as bind::BindDescriptor>::ValueTy>}

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> = {wasm_bindgen::JsValue::as_f64 as for<'a> fn(&'a wasm_bindgen::JsValue) -> std::option::Option<<bind::valueAsNumber as bind::BindDescriptor>::ValueTy>}

Source§

type Event = input

Source§

type ValueTy = f64