Enum sauron::html::attributes::AttributeValue
source · [−]pub enum AttributeValue<MSG> {
FunctionCall(Value),
Simple(Value),
Style(Vec<Style, Global>),
EventListener(Listener<Event, 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, Global>)
style values
EventListener(Listener<Event, MSG>)
Event Listener
Empty
no value
Implementations
sourceimpl<MSG> AttributeValue<MSG>
impl<MSG> AttributeValue<MSG>
sourcepub fn from_styles(
styles: impl IntoIterator<Item = Style>
) -> AttributeValue<MSG>
pub fn from_styles(
styles: impl IntoIterator<Item = Style>
) -> AttributeValue<MSG>
create an attribute from Vec
sourcepub fn from_value(value: Value) -> AttributeValue<MSG>
pub fn from_value(value: Value) -> AttributeValue<MSG>
create an attribute value from simple value
sourcepub fn function_call(value: Value) -> AttributeValue<MSG>
pub fn function_call(value: Value) -> AttributeValue<MSG>
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<Event, MSG>>
pub fn as_event_listener(&self) -> Option<&Listener<Event, MSG>>
return the styles if the attribute value is a style
sourcepub fn as_style(&self) -> Option<&Vec<Style, Global>>
pub fn as_style(&self) -> Option<&Vec<Style, Global>>
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
sourceimpl<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
sourceimpl<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
sourcepub fn clone(&self) -> AttributeValue<MSG>
pub fn clone(&self) -> AttributeValue<MSG>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<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
sourceimpl<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
Auto Trait Implementations
impl<MSG> !RefUnwindSafe for AttributeValue<MSG>
impl<MSG> !Send for AttributeValue<MSG>
impl<MSG> !Sync for AttributeValue<MSG>
impl<MSG> Unpin for AttributeValue<MSG>
impl<MSG> !UnwindSafe for AttributeValue<MSG>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more