pub struct SemanticClassNames<S: Hash + Eq> { /* private fields */ }Expand description
A collection of CSS class names keyed by semantic slot name.
Used to customize the styling of specific parts of a component.
§Example
ⓘ
use adui_dioxus::foundation::SemanticClassNames;
#[derive(Hash, Eq, PartialEq, Clone, Copy)]
enum ButtonSemantic {
Root,
Icon,
Content,
}
let mut class_names = SemanticClassNames::new();
class_names.set(ButtonSemantic::Root, "my-custom-button");
class_names.set(ButtonSemantic::Icon, "my-custom-icon");Implementations§
Source§impl<S: Hash + Eq> SemanticClassNames<S>
impl<S: Hash + Eq> SemanticClassNames<S>
Sourcepub fn set(&mut self, slot: S, class_name: impl Into<String>)
pub fn set(&mut self, slot: S, class_name: impl Into<String>)
Set the class name for a specific semantic slot.
Sourcepub fn get(&self, slot: &S) -> Option<&str>
pub fn get(&self, slot: &S) -> Option<&str>
Get the class name for a specific semantic slot, if set.
Sourcepub fn get_or_empty(&self, slot: &S) -> &str
pub fn get_or_empty(&self, slot: &S) -> &str
Get the class name for a slot or return an empty string.
Trait Implementations§
Source§impl<S: Clone + Hash + Eq> Clone for SemanticClassNames<S>
impl<S: Clone + Hash + Eq> Clone for SemanticClassNames<S>
Source§fn clone(&self) -> SemanticClassNames<S>
fn clone(&self) -> SemanticClassNames<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Default + Hash + Eq> Default for SemanticClassNames<S>
impl<S: Default + Hash + Eq> Default for SemanticClassNames<S>
Source§fn default() -> SemanticClassNames<S>
fn default() -> SemanticClassNames<S>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<S> Freeze for SemanticClassNames<S>
impl<S> RefUnwindSafe for SemanticClassNames<S>where
S: RefUnwindSafe,
impl<S> Send for SemanticClassNames<S>where
S: Send,
impl<S> Sync for SemanticClassNames<S>where
S: Sync,
impl<S> Unpin for SemanticClassNames<S>where
S: Unpin,
impl<S> UnwindSafe for SemanticClassNames<S>where
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.