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

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

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_core::html::attributes::{title,empty_attr};
use sauron_core::Attribute;

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);