pub enum AttributeValue {
Text(String),
Float(f64),
Int(i64),
Bool(bool),
Listener(EventHandler<Event<dyn Any>>),
Any(Rc<dyn AnyValue>),
None,
}
Expand description
Any of the built-in values that the Dioxus VirtualDom supports as dynamic attributes on elements
These are built-in to be faster during the diffing process. To use a custom value, use the AttributeValue::Any
variant.
Variants§
Text(String)
Text attribute
Float(f64)
A float
Int(i64)
Signed integer
Bool(bool)
Boolean
Listener(EventHandler<Event<dyn Any>>)
A listener, like “onclick”
Any(Rc<dyn AnyValue>)
An arbitrary value that implements PartialEq and is static
None
A “none” value, resulting in the removal of an attribute from the dom
Implementations§
Source§impl AttributeValue
impl AttributeValue
Sourcepub fn listener<T: 'static>(
callback: impl FnMut(Event<T>) + 'static,
) -> AttributeValue
pub fn listener<T: 'static>( callback: impl FnMut(Event<T>) + 'static, ) -> AttributeValue
Create a new AttributeValue
with the listener variant from a callback
The callback must be confined to the lifetime of the ScopeState
Sourcepub fn any_value<T: AnyValue>(value: T) -> AttributeValue
pub fn any_value<T: AnyValue>(value: T) -> AttributeValue
Create a new AttributeValue
with a value that implements [AnyValue
]
Trait Implementations§
Source§impl Clone for AttributeValue
impl Clone for AttributeValue
Source§fn clone(&self) -> AttributeValue
fn clone(&self) -> AttributeValue
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 Debug for AttributeValue
impl Debug for AttributeValue
Source§impl IntoAttributeValue for AttributeValue
impl IntoAttributeValue for AttributeValue
Source§fn into_value(self) -> AttributeValue
fn into_value(self) -> AttributeValue
Convert into an attribute value
Source§impl PartialEq for AttributeValue
impl PartialEq for AttributeValue
Auto Trait Implementations§
impl Freeze for AttributeValue
impl !RefUnwindSafe for AttributeValue
impl !Send for AttributeValue
impl !Sync for AttributeValue
impl Unpin for AttributeValue
impl !UnwindSafe for AttributeValue
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.