Function sauron::prelude::empty_attr

source ·
pub fn empty_attr<MSG>() -> Attribute<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::*;
use sauron::html::attributes::empty_attr;

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