pub struct CustomVariant {
pub variant_type: CustomVariantType,
pub name: String,
pub value: Option<String>,
pub enabled: bool,
pub config: HashMap<String, Value>,
}
Expand description
A custom variant definition
Fields§
§variant_type: CustomVariantType
The variant type
name: String
The variant name (without prefix)
value: Option<String>
The variant value (for aria, data, etc.)
enabled: bool
Whether this variant is enabled
config: HashMap<String, Value>
Custom configuration for this variant
Implementations§
Source§impl CustomVariant
impl CustomVariant
Sourcepub fn new(
variant_type: CustomVariantType,
name: String,
value: Option<String>,
) -> Result<Self>
pub fn new( variant_type: CustomVariantType, name: String, value: Option<String>, ) -> Result<Self>
Create a new custom variant
Sourcepub fn container(name: String, value: Option<String>) -> Result<Self>
pub fn container(name: String, value: Option<String>) -> Result<Self>
Create a container variant
Sourcepub fn to_variant_string(&self) -> String
pub fn to_variant_string(&self) -> String
Get the full variant string (e.g., “aria-checked”, “data-theme=dark”)
Sourcepub fn to_css_selector(&self) -> String
pub fn to_css_selector(&self) -> String
Get the CSS selector for this variant
Sourcepub fn set_config(&mut self, key: String, value: Value)
pub fn set_config(&mut self, key: String, value: Value)
Set a configuration value
Sourcepub fn get_config(&self, key: &str) -> Option<&Value>
pub fn get_config(&self, key: &str) -> Option<&Value>
Get a configuration value
Trait Implementations§
Source§impl Clone for CustomVariant
impl Clone for CustomVariant
Source§fn clone(&self) -> CustomVariant
fn clone(&self) -> CustomVariant
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 Debug for CustomVariant
impl Debug for CustomVariant
Source§impl<'de> Deserialize<'de> for CustomVariant
impl<'de> Deserialize<'de> for CustomVariant
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CustomVariant
impl Display for CustomVariant
Source§impl PartialEq for CustomVariant
impl PartialEq for CustomVariant
Source§impl Serialize for CustomVariant
impl Serialize for CustomVariant
impl StructuralPartialEq for CustomVariant
Auto Trait Implementations§
impl Freeze for CustomVariant
impl RefUnwindSafe for CustomVariant
impl Send for CustomVariant
impl Sync for CustomVariant
impl Unpin for CustomVariant
impl UnwindSafe for CustomVariant
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