pub trait InputElement<E>:
Deref<Target = E>
+ From<Rc<E>>
+ Clone {
type T;
// Required methods
fn get(&self) -> Option<Self::T>;
fn set(&self, value: &Self::T);
}Expand description
HTML input element.
This trait models an abstract HTML input element whose value can can be get
and setted. The type T corresponds to the Rust type of the value of the
input element. The generic type E corresponds to the HTML input element
type from web_sys.
This trait is intended to be implement for types that behave like a wrapper
over Rc<E>.
Required Associated Types§
Required Methods§
Sourcefn get(&self) -> Option<Self::T>
fn get(&self) -> Option<Self::T>
Gets the value of the input element.
This function attempts to convert the contents of the input element into
a Rust value of type T. If the conversion is successful, the value is
returned inside a Some. If the format of the contents of the input
element is not correct and a Rust value cannot be obtained, None is
returned.
Sourcefn set(&self, value: &Self::T)
fn set(&self, value: &Self::T)
Sets the value of the input element.
This function sets the contents of the input element to match that of
the Rust value given in the value argument. After the input element is
set, its contents might not match exactly the Rust value, for instance
due to rounding to represent a floating point number with fewer decimals
in a text field.
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.