Trait OptionAttribute

Source
pub trait OptionAttribute {
    // Required method
    fn value(&self) -> String;
}
Expand description

A trait for handling optional attribute values.

This trait is automatically implemented for Option<T> where T implements ToString. It allows for graceful handling of optional attributes, rendering them as empty strings when None.

§Example

use simple_rsx::*;

let maybe_title = Some("Hello".to_string());
let element = rsx!(<div title={maybe_title} />);

Required Methods§

Source

fn value(&self) -> String

Implementations on Foreign Types§

Source§

impl<T: ToString> OptionAttribute for Option<T>

Source§

fn value(&self) -> String

Implementors§