Function sauron::prelude::empty_attr[][src]

pub fn empty_attr<MSG>(
) -> Attribute<&'static str, &'static str, AttributeValue<MSG>>
Expand description

a utility function to return create an empty attr, useful for cases where branch expression need to return an attribute which otherwise it can not produce example:

use sauron::prelude::*;
use sauron::html::attributes::title;

let img_title = Some("this is the image");
let result: Attribute<()> = if let Some(img_title) = img_title{
    title(img_title)
}
else{
    empty_attr()
};
assert_eq!(title("this is the image"), result);