pub struct AttributeGroup { /* private fields */ }Expand description
A group of attributes.
Attribute groups follow the syntax @[attr1, attr2(args), ...].
Implementations§
Source§impl AttributeGroup
impl AttributeGroup
Sourcepub fn new(attribute: impl Into<AttributeGroupElement>) -> Self
pub fn new(attribute: impl Into<AttributeGroupElement>) -> Self
Creates a new attribute group with a single attribute.
Sourcepub fn with_attribute(self, attribute: impl Into<AttributeGroupElement>) -> Self
pub fn with_attribute(self, attribute: impl Into<AttributeGroupElement>) -> Self
Adds an attribute to this group.
Sourcepub fn append_attribute(&mut self, attribute: impl Into<AttributeGroupElement>)
pub fn append_attribute(&mut self, attribute: impl Into<AttributeGroupElement>)
Appends an attribute to this group.
Sourcepub fn iter_attributes(&self) -> impl Iterator<Item = &AttributeGroupElement>
pub fn iter_attributes(&self) -> impl Iterator<Item = &AttributeGroupElement>
Returns an iterator over the attributes in this group.
Sourcepub fn iter_mut_attributes(
&mut self,
) -> impl Iterator<Item = &mut AttributeGroupElement>
pub fn iter_mut_attributes( &mut self, ) -> impl Iterator<Item = &mut AttributeGroupElement>
Returns a mutable iterator over the attributes in this group.
Sourcepub fn with_tokens(self, tokens: AttributeGroupTokens) -> Self
pub fn with_tokens(self, tokens: AttributeGroupTokens) -> Self
Attaches tokens to this attribute group.
Sourcepub fn set_tokens(&mut self, tokens: AttributeGroupTokens)
pub fn set_tokens(&mut self, tokens: AttributeGroupTokens)
Sets the tokens for this attribute group.
Sourcepub fn get_tokens(&self) -> Option<&AttributeGroupTokens>
pub fn get_tokens(&self) -> Option<&AttributeGroupTokens>
Returns the tokens for this attribute group, if any.
Sourcepub fn mutate_tokens(&mut self) -> Option<&mut AttributeGroupTokens>
pub fn mutate_tokens(&mut self) -> Option<&mut AttributeGroupTokens>
Returns a mutable reference to the tokens for this attribute group, if any.
Sourcepub fn has_attribute(&self, name: &str) -> bool
pub fn has_attribute(&self, name: &str) -> bool
Checks if an attribute with the given name exists in this group.
Sourcepub fn remove(&mut self, index: usize)
pub fn remove(&mut self, index: usize)
Removes an attribute element at the specified index. Updates separator tokens if present.
Sourcepub fn filter_attributes<F>(&mut self, predicate: F)
pub fn filter_attributes<F>(&mut self, predicate: F)
Filters attribute elements based on a predicate, keeping only those that return true. Updates separator tokens to stay synchronized with the attributes.
Sourcepub fn filter_mut_attributes<F>(&mut self, predicate: F)
pub fn filter_mut_attributes<F>(&mut self, predicate: F)
Filters attribute elements with mutable access, keeping only those that return true. Updates separator tokens to stay synchronized with the attributes.
Sourcepub fn clear_comments(&mut self)
pub fn clear_comments(&mut self)
Clears all comments from the tokens in this node.
Sourcepub fn clear_whitespaces(&mut self)
pub fn clear_whitespaces(&mut self)
Clears all whitespaces information from the tokens in this node.
Trait Implementations§
Source§impl Clone for AttributeGroup
impl Clone for AttributeGroup
Source§fn clone(&self) -> AttributeGroup
fn clone(&self) -> AttributeGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AttributeGroup
impl Debug for AttributeGroup
Source§impl From<AttributeGroup> for Attribute
impl From<AttributeGroup> for Attribute
Source§fn from(v: AttributeGroup) -> Self
fn from(v: AttributeGroup) -> Self
Source§impl PartialEq for AttributeGroup
impl PartialEq for AttributeGroup
impl Eq for AttributeGroup
impl StructuralPartialEq for AttributeGroup
Auto Trait Implementations§
impl Freeze for AttributeGroup
impl RefUnwindSafe for AttributeGroup
impl Send for AttributeGroup
impl Sync for AttributeGroup
impl Unpin for AttributeGroup
impl UnsafeUnpin for AttributeGroup
impl UnwindSafe for AttributeGroup
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
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more