Enum sauron_core::html::attributes::AttributeValue
source · pub enum AttributeValue<MSG> {
FunctionCall(Value),
Simple(Value),
Style(Vec<Style>),
EventListener(Listener<MSG>),
Empty,
}
Expand description
Values of an attribute can be in these variants
Variants§
FunctionCall(Value)
an argument value, to be called as parameter, the function is called to the element
Simple(Value)
a simple value, wrapper of primitive types
Style(Vec<Style>)
style values
EventListener(Listener<MSG>)
Event Listener
Empty
no value
Implementations§
source§impl<MSG> AttributeValue<MSG>
impl<MSG> AttributeValue<MSG>
sourcepub fn from_styles(styles: impl IntoIterator<Item = Style>) -> Self
pub fn from_styles(styles: impl IntoIterator<Item = Style>) -> Self
create an attribute from Vec
sourcepub fn function_call(value: Value) -> Self
pub fn function_call(value: Value) -> Self
create an attribute from a function name
with arguments value
sourcepub fn get_simple(&self) -> Option<&Value>
pub fn get_simple(&self) -> Option<&Value>
return the value if it is a Simple variant
sourcepub fn get_function_call_value(&self) -> Option<&Value>
pub fn get_function_call_value(&self) -> Option<&Value>
return the function call argument value if it is a FunctionCall variant
sourcepub fn as_event_listener(&self) -> Option<&Listener<MSG>>
pub fn as_event_listener(&self) -> Option<&Listener<MSG>>
return the styles if the attribute value is a style
sourcepub fn as_style(&self) -> Option<&Vec<Style>>
pub fn as_style(&self) -> Option<&Vec<Style>>
return the styles if the attribute value is a style
sourcepub fn is_function_call(&self) -> bool
pub fn is_function_call(&self) -> bool
return true if this is a function call
source§impl<MSG> AttributeValue<MSG>where
MSG: 'static,
impl<MSG> AttributeValue<MSG>where MSG: 'static,
sourcepub fn map_callback<MSG2>(self, cb: Listener<MSG, MSG2>) -> AttributeValue<MSG2>where
MSG2: 'static,
pub fn map_callback<MSG2>(self, cb: Listener<MSG, MSG2>) -> AttributeValue<MSG2>where MSG2: 'static,
map the callback of this attribute using another callback
Trait Implementations§
source§impl<MSG> Clone for AttributeValue<MSG>
impl<MSG> Clone for AttributeValue<MSG>
This is written manually, so we don’t push constraint on MSG to be Clone
source§impl<MSG> Debug for AttributeValue<MSG>
impl<MSG> Debug for AttributeValue<MSG>
This is written manually, so we don’t push constraint on MSG to be Debug
source§impl<MSG> PartialEq<AttributeValue<MSG>> for AttributeValue<MSG>
impl<MSG> PartialEq<AttributeValue<MSG>> for AttributeValue<MSG>
This is written manually, so we don’t push constraint on MSG to be PartialEq