#[non_exhaustive]pub enum AttributeValue {
Absent,
Empty,
PromotedStr {
value: &'static &'static str,
context: HtmlContext,
},
StaticStr {
value: &'static str,
context: HtmlContext,
},
String {
value: String,
context: HtmlContext,
},
}Expand description
An attribute value captured from any AttributeValueViewParts value.
Values retain their HTML context for escaping when rendered. Reusing a captured value as an attribute value or class entry preserves its output.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Absent
Marks the attribute as not rendered.
An absent value keeps its key in an Attributes
collection, so it still replaces an earlier value when collections
are merged, but the attribute is not rendered.
Empty
A present value that renders nothing, like a true boolean
attribute (disabled="").
PromotedStr
A static string held by reference.
StaticStr
A static string.
String
An owned string.
Implementations§
Source§impl AttributeValue
impl AttributeValue
Sourcepub fn is_present(&self) -> bool
pub fn is_present(&self) -> bool
Returns whether the attribute holding this value should be rendered.
Trait Implementations§
Source§impl AttributeValueViewParts for AttributeValue
impl AttributeValueViewParts for AttributeValue
Source§fn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Source§fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl AttributeValueViewParts for &AttributeValue
impl AttributeValueViewParts for &AttributeValue
Source§fn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Source§fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl ClassViewParts for AttributeValue
A captured attribute value spliced in as a single class list entry, such
as one taken from an Attributes collection with
remove. An absent value is skipped.
impl ClassViewParts for AttributeValue
A captured attribute value spliced in as a single class list entry, such
as one taken from an Attributes collection with
remove. An absent value is skipped.
Source§fn is_present(&self) -> bool
fn is_present(&self) -> bool
Source§fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl ClassViewParts for &AttributeValue
impl ClassViewParts for &AttributeValue
Source§fn is_present(&self) -> bool
fn is_present(&self) -> bool
Source§fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl Clone for AttributeValue
impl Clone for AttributeValue
Source§impl Debug for AttributeValue
impl Debug for AttributeValue
Auto Trait Implementations§
impl Freeze for AttributeValue
impl RefUnwindSafe for AttributeValue
impl Send for AttributeValue
impl Sync for AttributeValue
impl Unpin for AttributeValue
impl UnsafeUnpin for AttributeValue
impl UnwindSafe for AttributeValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassEntries for Twhere
T: ClassViewParts,
impl<T> ClassEntries for Twhere
T: ClassViewParts,
Source§fn any_present(&self) -> bool
fn any_present(&self) -> bool
Source§fn write_entries(self, cx: &Cx, writer: &mut ClassWriter<'_, '_>)
fn write_entries(self, cx: &Cx, writer: &mut ClassWriter<'_, '_>)
writer.