Enum rustcn_ui::dioxus_core::AttributeValue
source · pub enum AttributeValue {
Text(String),
Float(f64),
Int(i64),
Bool(bool),
Listener(EventHandler<Event<dyn Any>>),
Any(Box<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(Box<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>(callback: impl FnMut(Event<T>) + 'static) -> AttributeValuewhere
T: 'static,
pub fn listener<T>(callback: impl FnMut(Event<T>) + 'static) -> AttributeValuewhere
T: 'static,
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>(value: T) -> AttributeValuewhere
T: AnyValue,
pub fn any_value<T>(value: T) -> AttributeValuewhere
T: AnyValue,
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
source§fn eq(&self, other: &AttributeValue) -> bool
fn eq(&self, other: &AttributeValue) -> bool
This method tests for
self and other values to be equal, and is used
by ==.Auto Trait Implementations§
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> 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<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.