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 u8)

🔬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