Skip to main content

AttributeValueViewParts

Trait AttributeValueViewParts 

Source
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§

Source

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.

Source

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".

Implementations on Foreign Types§

Source§

impl AttributeValueViewParts for &String

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &bool

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &char

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &f32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &f64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &i8

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &i16

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &i32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &i64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &i128

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &isize

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &str

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &u8

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &u16

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &u32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &u64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &u128

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for &usize

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for String

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for bool

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for char

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for f32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for f64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for i8

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for i16

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for i32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for i64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for i128

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for isize

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for u8

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for u16

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for u32

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for u64

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for u128

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl AttributeValueViewParts for usize

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, _cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<'b, T: ?Sized> AttributeValueViewParts for &&'b T

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7, T8, T9)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7, T8> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7, T8)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6, T7> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6, T7)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5, T6> AttributeValueViewParts for (T1, T2, T3, T4, T5, T6)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4, T5> AttributeValueViewParts for (T1, T2, T3, T4, T5)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3, T4> AttributeValueViewParts for (T1, T2, T3, T4)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2, T3> AttributeValueViewParts for (T1, T2, T3)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1, T2> AttributeValueViewParts for (T1, T2)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T1> AttributeValueViewParts for (T1,)

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Source§

impl<T> AttributeValueViewParts for Option<T>

Source§

fn attribute_present(&self) -> bool

Source§

fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)

Implementors§