pub trait IntoAttrValue {
// Required method
fn into_attr_value(self) -> AttrValue;
}Expand description
The bound on every attribute value - what DomElement::attr
and the dom! macro accept.
Vertigo implements it exactly once, as a blanket over Into<AttrValue>; it exists so that
the compiler has somewhere to hang an explanation. The conversions that blanket picks up
are the From impls below plus whatever opts in through DomDisplay, and a type
outside both fails a From bound whose error names a hundred impls and none of the ones
you want.
A crate of its own may implement this trait directly for its own type - coherence
permits it, since only that crate could ever give the type a DomDisplay impl. But
DomDisplay is one line rather than a function body, it also reaches &T,
Computed<T> and Value<T>, and it renders the same
type as a text node in dom! too.
Required Methods§
fn into_attr_value(self) -> AttrValue
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl<T: Into<AttrValue>> IntoAttrValue for T
Without this, a missing conversion is reported as the From obligation inside this
impl - a hundred From impls and no advice - rather than as the bound the call site
actually wrote.