pub struct Attribute<MSG> {
pub namespace: Option<Namespace>,
pub name: AttributeName,
pub value: Vec<AttributeValue<MSG>>,
}
Expand description
These are the plain attributes of an element
Fields§
§namespace: Option<Namespace>
namespace of an attribute. This is specifically used by svg attributes such as xlink-href
name: AttributeName
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<Namespace>,
name: AttributeName,
value: AttributeValue<MSG>,
) -> Self
pub fn new( namespace: Option<Namespace>, name: AttributeName, value: AttributeValue<MSG>, ) -> Self
create a plain attribute with namespace
Sourcepub fn with_multiple_values(
namespace: Option<Namespace>,
name: AttributeName,
value: impl IntoIterator<Item = AttributeValue<MSG>>,
) -> Self
pub fn with_multiple_values( namespace: Option<Namespace>, name: AttributeName, value: impl IntoIterator<Item = AttributeValue<MSG>>, ) -> Self
create from multiple values
Sourcepub fn name(&self) -> &AttributeName
pub fn name(&self) -> &AttributeName
return the name of this attribute
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§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.