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§
Provided Methods§
Sourcefn with_class(self, class: impl Into<ClassName>) -> Selfwhere
Self: Sized,
fn with_class(self, class: impl Into<ClassName>) -> Selfwhere
Self: Sized,
Add the given class by consuming self
Sourcefn with_class_if(self, class: impl Into<ClassName>, condition: bool) -> Selfwhere
Self: Sized,
fn with_class_if(self, class: impl Into<ClassName>, condition: bool) -> Selfwhere
Self: Sized,
Add the given class by consuming self if the condition is true
Sourcefn add_class(&mut self, class: impl Into<ClassName>) -> &mut Selfwhere
Self: Sized,
fn add_class(&mut self, class: impl Into<ClassName>) -> &mut Selfwhere
Self: Sized,
Add the given class in-place
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".