Function sauron::prelude::html::attributes::attrs_flag[][src]

pub fn attrs_flag<V, MSG, P>(
    trio: P
) -> Vec<Attribute<&'static str, &'static str, AttributeValue<MSG>>, Global>
Notable traits for Vec<u8, A>
impl<A> Write for Vec<u8, A> where
    A: Allocator
where
    V: Into<Value> + Clone,
    P: AsRef<[(&'static str, V, bool)]>, 
Expand description

A helper function for setting attributes with no values such as checked in checkbox input type This is best called to be appended to the node since this returns an array of attributes which doesn’t play well with the others

Examples

use sauron::prelude::*;

let is_checked = true;
let html: Node<()> =
    input(vec![r#type("checkbox")], vec![]).add_attributes(attrs_flag(vec![(
                            "checked",
                            "checked",
                            is_checked,
                        )]));