This is unreleased documentation for Yew Next version.
For up-to-date documentation, see the latest version on docs.rs.
yew::html

Struct Classes

source
pub struct Classes { /* private fields */ }
Expand description

A set of classes, cheap to clone.

The preferred way of creating this is using the classes! macro.

Implementations§

source§

impl Classes

source

pub fn new() -> Self

Creates an empty set of classes. (Does not allocate.)

source

pub fn with_capacity(n: usize) -> Self

Creates an empty set of classes with capacity for n elements. (Does not allocate if n is zero.)

source

pub fn push<T: Into<Self>>(&mut self, class: T)

Adds a class to a set.

If the provided class has already been added, this method will ignore it.

source

pub unsafe fn unchecked_push<T: Into<AttrValue>>(&mut self, class: T)

Adds a class to a set.

If the provided class has already been added, this method will ignore it.

This method won’t check if there are multiple classes in the input string.

§Safety

This function will not split the string into multiple classes. Please do not use it unless you are absolutely certain that the string does not contain any whitespace and it is not empty. Using push() is preferred.

source

pub fn contains<T: AsRef<str>>(&self, class: T) -> bool

Check the set contains a class.

source

pub fn is_empty(&self) -> bool

Check the set is empty.

Trait Implementations§

source§

impl Clone for Classes

source§

fn clone(&self) -> Classes

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Classes

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Classes

source§

fn default() -> Classes

Returns the “default value” for a type. Read more
source§

impl<T: Into<Classes>> Extend<T> for Classes

source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
source§

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)

🔬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<T: Into<Classes> + Clone> From<&[T]> for Classes

source§

fn from(t: &[T]) -> Self

Converts to this type from the input type.
source§

impl From<&IString> for Classes

source§

fn from(t: &AttrValue) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Classes> + Clone> From<&Option<T>> for Classes

source§

fn from(t: &Option<T>) -> Self

Converts to this type from the input type.
source§

impl From<&String> for Classes

source§

fn from(t: &String) -> Self

Converts to this type from the input type.
source§

impl From<&'static str> for Classes

source§

fn from(t: &'static str) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Classes>, const SIZE: usize> From<[T; SIZE]> for Classes

source§

fn from(t: [T; SIZE]) -> Self

Converts to this type from the input type.
source§

impl From<Cow<'static, str>> for Classes

source§

fn from(t: Cow<'static, str>) -> Self

Converts to this type from the input type.
source§

impl From<IString> for Classes

source§

fn from(t: AttrValue) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Classes>> From<Option<T>> for Classes

source§

fn from(t: Option<T>) -> Self

Converts to this type from the input type.
source§

impl From<String> for Classes

source§

fn from(t: String) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Classes>> From<Vec<T>> for Classes

source§

fn from(t: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Classes>> FromIterator<T> for Classes

source§

fn from_iter<IT: IntoIterator<Item = T>>(iter: IT) -> Self

Creates a value from an iterator. Read more
source§

impl ImplicitClone for Classes

§

fn implicit_clone(&self) -> Self

This function is not magic; it is literally defined as Read more
source§

impl IntoIterator for &Classes

source§

type IntoIter = IntoIter<IString>

Which kind of iterator are we turning this into?
source§

type Item = IString

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoIterator for Classes

source§

type IntoIter = IntoIter<IString>

Which kind of iterator are we turning this into?
source§

type Item = IString

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl IntoPropValue<Classes> for &'static str

source§

fn into_prop_value(self) -> Classes

Convert self to a value of a Properties struct.
source§

impl IntoPropValue<IString> for Classes

source§

fn into_prop_value(self) -> AttrValue

Convert self to a value of a Properties struct.
source§

impl IntoPropValue<Option<IString>> for Classes

source§

fn into_prop_value(self) -> Option<AttrValue>

Convert self to a value of a Properties struct.
source§

impl PartialEq for Classes

source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToString for Classes

source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl Eq for Classes

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoPropValue<Option<T>> for T

source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
source§

impl<T> IntoPropValue<T> for T

source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more