pub trait AttrSet {
// Required method
fn add_attrs(&self, attrs: &mut Attrs);
}Expand description
Something that can contribute whole entries to an Attrs.
The seam a #[prop(rest)] field is filled through: attrs={…} written at a
call site, {...expr} spread onto a component, and every positional entry
of {@attrs(…)}. A set is read from a reference and folded in, rather than
moved out of the component holding it.
Notably not implemented for strings. A string is markup, and this bag
holds pairs it escapes one at a time; the diagnostic below is what the older
attrs={r#"data-controller="signup""#} spelling now says, so a call site
that still assembles markup is a build failure rather than a page that looks
right until a value in it needs escaping.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<K: AsRef<str>, V: IntoAttrValue + Clone, S> AttrSet for HashMap<K, V, S>
Visited in key order rather than the map’s own, because a HashMap has no
stable one — the same render would otherwise emit the same attributes in a
different order each run, which no snapshot test or cache could live with.
impl<K: AsRef<str>, V: IntoAttrValue + Clone, S> AttrSet for HashMap<K, V, S>
Visited in key order rather than the map’s own, because a HashMap has no
stable one — the same render would otherwise emit the same attributes in a
different order each run, which no snapshot test or cache could live with.