Enum sauron::prelude::AttributeValue
source · pub enum AttributeValue<MSG> {
Simple(Value),
Style(Vec<Style>),
EventListener(Callback<Event, MSG>),
ComponentEventListener(Callback<Event, ()>),
Empty,
}
Expand description
Values of an attribute can be in these variants
Variants§
Simple(Value)
a simple value, wrapper of primitive types
Style(Vec<Style>)
style values
EventListener(Callback<Event, MSG>)
Event EventCallback
ComponentEventListener(Callback<Event, ()>)
Component Event Listener
Empty
no value
Implementations§
source§impl<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 get_simple(&self) -> Option<&Value>
pub fn get_simple(&self) -> Option<&Value>
return the value if it is a Simple variant
sourcepub fn as_event_listener(&self) -> Option<&Callback<Event, MSG>>
pub fn as_event_listener(&self) -> Option<&Callback<Event, MSG>>
return the styles if the attribute value is a style
sourcepub fn is_event_listener(&self) -> bool
pub fn is_event_listener(&self) -> bool
return true if this is an event listener
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_just_empty(&self) -> bool
pub fn is_just_empty(&self) -> bool
returns true if this attribute value is the filler empty attribute
source§impl<MSG> AttributeValue<MSG>
impl<MSG> AttributeValue<MSG>
sourcepub fn map_msg<F, MSG2>(self, cb: F) -> AttributeValue<MSG2>
pub fn map_msg<F, MSG2>(self, cb: F) -> AttributeValue<MSG2>
map the msg of this AttributeValue such that AttributeValue<MSG>
becomes
AttributeValue<MSG2>
Trait Implementations§
source§impl<MSG> Clone for AttributeValue<MSG>
impl<MSG> Clone for AttributeValue<MSG>
source§fn clone(&self) -> AttributeValue<MSG>
fn clone(&self) -> AttributeValue<MSG>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<MSG> Debug for AttributeValue<MSG>
impl<MSG> Debug for AttributeValue<MSG>
source§impl<MSG, V> From<V> for AttributeValue<MSG>
impl<MSG, V> From<V> for AttributeValue<MSG>
source§fn from(v: V) -> AttributeValue<MSG>
fn from(v: V) -> AttributeValue<MSG>
Converts to this type from the input type.
source§impl<MSG> PartialEq for AttributeValue<MSG>
impl<MSG> PartialEq for AttributeValue<MSG>
This is written manually, so we don’t push constraint on MSG to be PartialEq and also, derive_where can not equate on event listeners
source§fn eq(&self, other: &AttributeValue<MSG>) -> bool
fn eq(&self, other: &AttributeValue<MSG>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<MSG> Eq for AttributeValue<MSG>
Auto Trait Implementations§
impl<MSG> Freeze for AttributeValue<MSG>
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.