Skip to main content

HasClasses

Trait HasClasses 

Source
pub trait HasClasses {
    // Required methods
    fn classes(&self) -> &Classes;
    fn classes_mut(&mut self) -> &mut Classes;

    // Provided methods
    fn with_class(self, class: impl Into<ClassName>) -> Self
       where Self: Sized { ... }
    fn with_class_if(self, class: impl Into<ClassName>, condition: bool) -> Self
       where Self: Sized { ... }
    fn add_class(&mut self, class: impl Into<ClassName>) -> &mut Self
       where Self: Sized { ... }
    fn add_class_if(
        &mut self,
        class: impl Into<ClassName>,
        condition: bool,
    ) -> &mut Self
       where Self: Sized { ... }
    fn has(&self, class: impl Into<ClassName>) -> bool { ... }
}
Expand description

Any widgets supporting Classes must implement this trait

Required Methods§

Source

fn classes(&self) -> &Classes

Source

fn classes_mut(&mut self) -> &mut Classes

Provided Methods§

Source

fn with_class(self, class: impl Into<ClassName>) -> Self
where Self: Sized,

Add the given class by consuming self

Source

fn with_class_if(self, class: impl Into<ClassName>, condition: bool) -> Self
where Self: Sized,

Add the given class by consuming self if the condition is true

Source

fn add_class(&mut self, class: impl Into<ClassName>) -> &mut Self
where Self: Sized,

Add the given class in-place

Source

fn add_class_if( &mut self, class: impl Into<ClassName>, condition: bool, ) -> &mut Self
where Self: Sized,

Add the given class in-place if the condition is true

Source

fn has(&self, class: impl Into<ClassName>) -> bool

True if the class is present

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§