pub struct Attribute<MSG> {
pub namespace: Option<&'static str>,
pub name: &'static str,
pub value: Vec<AttributeValue<MSG>>,
}
Expand description
These are the plain attributes of an element
Fields§
§namespace: Option<&'static str>
namespace of an attribute. This is specifically used by svg attributes such as xlink-href
name: &'static str
the attribute name, optional since style attribute doesn’t need to have an attribute name
value: Vec<AttributeValue<MSG>>
the attribute value, which could be a simple value, and event or a function call
Implementations§
source§impl<MSG> Attribute<MSG>
impl<MSG> Attribute<MSG>
sourcepub fn new(
namespace: Option<&'static str>,
name: &'static str,
value: AttributeValue<MSG>
) -> Attribute<MSG>
pub fn new( namespace: Option<&'static str>, name: &'static str, value: AttributeValue<MSG> ) -> Attribute<MSG>
create a plain attribute with namespace
sourcepub fn with_multiple_values(
namespace: Option<&'static str>,
name: &'static str,
value: impl IntoIterator<Item = AttributeValue<MSG>>
) -> Attribute<MSG>
pub fn with_multiple_values( namespace: Option<&'static str>, name: &'static str, value: impl IntoIterator<Item = AttributeValue<MSG>> ) -> Attribute<MSG>
create from multiple values
sourcepub fn value(&self) -> &[AttributeValue<MSG>]
pub fn value(&self) -> &[AttributeValue<MSG>]
return the value of this attribute
sourcepub fn is_event_listener(&self) -> bool
pub fn is_event_listener(&self) -> bool
returns true if this attribute is an event listener
sourcepub fn merge_attributes_of_same_name<'a>(
attributes: impl IntoIterator<Item = &'a Attribute<MSG>> + Iterator
) -> Vec<Attribute<MSG>>where
MSG: 'a,
pub fn merge_attributes_of_same_name<'a>(
attributes: impl IntoIterator<Item = &'a Attribute<MSG>> + Iterator
) -> Vec<Attribute<MSG>>where
MSG: 'a,
merge the values of attributes with the same name also exclude the empty attribute
Trait Implementations§
source§impl<MSG> PartialEq for Attribute<MSG>
impl<MSG> PartialEq for Attribute<MSG>
impl<MSG> Eq for Attribute<MSG>
Auto Trait Implementations§
impl<MSG> Freeze for Attribute<MSG>
impl<MSG> !RefUnwindSafe for Attribute<MSG>
impl<MSG> !Send for Attribute<MSG>
impl<MSG> !Sync for Attribute<MSG>
impl<MSG> Unpin for Attribute<MSG>
impl<MSG> !UnwindSafe for Attribute<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.