pub enum ClassList {
Owned(Vec<Cow<'static, str>>),
Static(&'static str),
Const(&'static [&'static str]),
Empty,
}
Expand description
Represents a collection of CSS classes applied to a DOM node.
Variants§
Owned(Vec<Cow<'static, str>>)
Owned storage for the list of classes.
Static(&'static str)
Single static class stored without allocation.
Const(&'static [&'static str])
Multiple static classes stored without allocation.
Empty
Explicit empty list of classes.
Implementations§
Source§impl ClassList
impl ClassList
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut Cow<'static, str>>
pub fn get_mut(&mut self, index: usize) -> Option<&mut Cow<'static, str>>
Gets a mutable reference to a class at a specific index.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for additional classes when owned.
Sourcepub fn contains(&self, class: &str) -> bool
pub fn contains(&self, class: &str) -> bool
Returns true
if the class list contains the specified class name.
Trait Implementations§
Source§impl Extend<Cow<'static, str>> for ClassList
impl Extend<Cow<'static, str>> for ClassList
Source§fn extend<T: IntoIterator<Item = Cow<'static, str>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Cow<'static, str>>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> IntoIterator for &'a ClassList
impl<'a> IntoIterator for &'a ClassList
Auto Trait Implementations§
impl Freeze for ClassList
impl RefUnwindSafe for ClassList
impl Send for ClassList
impl Sync for ClassList
impl Unpin for ClassList
impl UnwindSafe for ClassList
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