pub enum NumericValue {
    Number {
        n: f32,
        negative: bool,
        can_be_negative: bool,
    },
    Keyword(String),
    Arbitrary(TailwindArbitrary),
}Expand description
Used to represent those attributes that only have integers
Variants§
Implementations§
Source§impl NumericValue
 
impl NumericValue
pub fn get_properties(&self, number: impl FnOnce(&f32) -> String) -> String
pub fn write_negative(&self, f: &mut Formatter<'_>) -> Result
Sourcepub fn write_class_name(&self, f: &mut Formatter<'_>, prefix: &str) -> Result
 
pub fn write_class_name(&self, f: &mut Formatter<'_>, prefix: &str) -> Result
Helper to write the Display classname for a NumericValue:
- For NumericValue::Number, it will be {negative}{prefix}{abs(value)}. Example: “-order-4”
- For NumericValue::Keyword, it will be {prefix}{value}. Example: “order-none”
- For NumericValue::Arbitrary, it will be {prefix}{value}. Example: “mt-[4rem]”
Source§impl NumericValue
 
impl NumericValue
Sourcepub fn negative_parser(
    id: &'static str,
    checker: impl Fn(&str) -> bool,
) -> impl Fn(&[&str], &TailwindArbitrary, Negative) -> Result<Self>
 
pub fn negative_parser( id: &'static str, checker: impl Fn(&str) -> bool, ) -> impl Fn(&[&str], &TailwindArbitrary, Negative) -> Result<Self>
For parsing numbers that can be negative.
Sourcepub fn positive_parser(
    id: &'static str,
    checker: impl Fn(&str) -> bool,
) -> impl Fn(&[&str], &TailwindArbitrary) -> Result<Self>
 
pub fn positive_parser( id: &'static str, checker: impl Fn(&str) -> bool, ) -> impl Fn(&[&str], &TailwindArbitrary) -> Result<Self>
For parsing numbers that cannot be negative.
pub fn parse_arbitrary(arbitrary: &TailwindArbitrary) -> Result<Self>
Sourcepub fn parse_number(n: &str, negative: Negative) -> Result<Self>
 
pub fn parse_number(n: &str, negative: Negative) -> Result<Self>
Helper for negative_parser
Trait Implementations§
Source§impl Clone for NumericValue
 
impl Clone for NumericValue
Source§fn clone(&self) -> NumericValue
 
fn clone(&self) -> NumericValue
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 NumericValue
 
impl Debug for NumericValue
Source§impl Display for NumericValue
 
impl Display for NumericValue
Source§impl From<&str> for NumericValue
 
impl From<&str> for NumericValue
Source§impl From<String> for NumericValue
 
impl From<String> for NumericValue
Source§impl From<i32> for NumericValue
 
impl From<i32> for NumericValue
Auto Trait Implementations§
impl Freeze for NumericValue
impl RefUnwindSafe for NumericValue
impl Send for NumericValue
impl Sync for NumericValue
impl Unpin for NumericValue
impl UnwindSafe for NumericValue
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> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more