pub enum UnitValue {
Number {
n: f32,
is_negative: bool,
},
Length(LengthUnit),
Keyword(String),
Arbitrary(TailwindArbitrary),
}Variants§
Implementations§
Source§impl UnitValue
impl UnitValue
pub fn px(x: f32) -> Self
pub fn ratio(a: u32, b: u32) -> Self
pub fn get_properties(&self, number: impl FnOnce(&f32) -> String) -> String
pub fn get_properties_rem(&self) -> String
pub fn write_negative(&self, f: &mut Formatter<'_>) -> Result
pub fn write_class(&self, f: &mut Formatter<'_>, before: &str) -> Result
Source§impl UnitValue
impl UnitValue
pub fn negative_parser( id: &'static str, check_valid: impl Fn(&str) -> bool, is_length: bool, is_integer: bool, allow_fraction: bool, ) -> impl Fn(&[&str], &TailwindArbitrary, Negative) -> Result<Self>
pub fn positive_parser( id: &'static str, check_valid: impl Fn(&str) -> bool, is_length: bool, is_integer: bool, allow_fraction: bool, ) -> impl Fn(&[&str], &TailwindArbitrary) -> Result<Self>
pub fn parse_arbitrary(arbitrary: &TailwindArbitrary) -> Result<Self>
pub fn parse_number( n: &str, negative: Negative, is_length: bool, is_integer: bool, can_be_fraction: bool, ) -> Result<Self>
Trait Implementations§
Source§impl From<&TailwindArbitrary> for UnitValue
impl From<&TailwindArbitrary> for UnitValue
Source§fn from(a: &TailwindArbitrary) -> Self
fn from(a: &TailwindArbitrary) -> Self
Converts to this type from the input type.
Source§impl From<LengthUnit> for UnitValue
impl From<LengthUnit> for UnitValue
Source§fn from(n: LengthUnit) -> Self
fn from(n: LengthUnit) -> Self
Converts to this type from the input type.
Source§impl From<TailwindArbitrary> for UnitValue
impl From<TailwindArbitrary> for UnitValue
Source§fn from(a: TailwindArbitrary) -> Self
fn from(a: TailwindArbitrary) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for UnitValue
impl RefUnwindSafe for UnitValue
impl Send for UnitValue
impl Sync for UnitValue
impl Unpin for UnitValue
impl UnwindSafe for UnitValue
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