pub trait AttributeValueViewParts {
// Required methods
fn attribute_present(&self) -> bool;
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>);
}Expand description
Converts a value used as an attribute value into view parts.
When this trait is implemented on a type, it can be used in the attribute value position of an
element in the view! macro:
view! {
<div class=(my_value)></div>
}For boolean HTML attributes, a false value must be omitted from the markup entirely.
attribute_present is the hook that makes that decision.
The built-in bool and Option<T> implementations use this so false and None omit the
whole attribute.
Required Methods§
Sourcefn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Returns whether the containing attribute should be rendered.
For boolean HTML attributes, a false value must be omitted from the markup entirely.
Sourcefn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
Appends this attribute value to the view being built.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".