ClassValidator

Struct ClassValidator 

Source
pub struct ClassValidator { /* private fields */ }
Expand description

Validates Tailwind class names at runtime

Implementations§

Source§

impl ClassValidator

Source

pub fn new() -> Self

Create a new validator instance

Source

pub fn with_rules(validation_rules: ValidationRules) -> Self

Create a new validator with custom rules

Source

pub fn with_custom_variants( custom_variant_manager: CustomVariantManager, ) -> Self

Create a new validator with custom variant manager

Source

pub fn set_error_reporter(&mut self, error_reporter: ErrorReporter)

Set error reporter

Source

pub fn validate_class(&self, class_name: &str) -> Result<(), ValidationError>

Validate a single class name

Source

pub fn validate_classes( &self, classes: &[String], ) -> Result<(), ValidationError>

Validate multiple class names

Source

pub fn validate_custom_variant( &self, variant: &str, ) -> Result<(), ValidationError>

Validate a custom variant (Tailwind v4.1.13 @custom-variant support)

Source

pub fn validate_variant_class( &self, variant: &str, class: &str, ) -> Result<(), ValidationError>

Validate a class with custom variant

Source

pub fn get_variant_suggestions(&self, partial: &str) -> Vec<String>

Get suggestions for a custom variant

Source

pub fn register_custom_variant( &mut self, variant: CustomVariant, ) -> Result<(), ValidationError>

Register a custom variant

Source

pub fn custom_variant_manager(&self) -> &CustomVariantManager

Get the custom variant manager

Source

pub fn custom_variant_manager_mut(&mut self) -> &mut CustomVariantManager

Get mutable access to the custom variant manager

Source

pub fn rules(&self) -> &ValidationRules

Get validation rules

Source

pub fn rules_mut(&mut self) -> &mut ValidationRules

Get mutable validation rules

Trait Implementations§

Source§

impl Default for ClassValidator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.