Home / File/ utility_machine.rs — tailwindcss Source File

utility_machine.rs — tailwindcss Source File

Architecture documentation for utility_machine.rs, a rust file in the tailwindcss codebase. 9 imports, 0 dependents.

File rust OxideEngine Extractor 9 imports 8 functions

Entity Profile

Dependency Diagram

graph LR
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2["utility_machine.rs"]
  04833133_a4d4_17a4_3316_70d0648c64f4["super::UtilityMachine"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 04833133_a4d4_17a4_3316_70d0648c64f4
  e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e["crate::cursor"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e
  5fc7954d_f03d_2659_287c_8b84c5a5fe3c["crate::extractor::arbitrary_property_machine::ArbitraryPropertyMachine"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 5fc7954d_f03d_2659_287c_8b84c5a5fe3c
  cd83abb6_a664_e16d_ddc8_60a3f23ba86a["crate::extractor::machine::"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> cd83abb6_a664_e16d_ddc8_60a3f23ba86a
  1a920851_3e8a_1119_744f_b3a2add5bb9f["crate::extractor::modifier_machine::ModifierMachine"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 1a920851_3e8a_1119_744f_b3a2add5bb9f
  8e70a60a_664f_5da5_91e8_a17a77f8375a["crate::extractor::named_utility_machine::NamedUtilityMachine"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 8e70a60a_664f_5da5_91e8_a17a77f8375a
  5731c53a_0325_b3af_2918_bcb379bc8ec6["classification_macros::ClassifyBytes"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 5731c53a_0325_b3af_2918_bcb379bc8ec6
  9a9673b5_10d4_f716_360c_b2510082b102["crate::extractor::machine::Machine"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> 9a9673b5_10d4_f716_360c_b2510082b102
  e4088d34_b5b4_ec51_b975_557a1536ec76["pretty_assertions::assert_eq"]
  32b9b48f_ad55_d7a6_3de9_85eb03c312f2 --> e4088d34_b5b4_ec51_b975_557a1536ec76
  style 32b9b48f_ad55_d7a6_3de9_85eb03c312f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use crate::cursor;
use crate::extractor::arbitrary_property_machine::ArbitraryPropertyMachine;
use crate::extractor::machine::{Machine, MachineState};
use crate::extractor::modifier_machine::ModifierMachine;
use crate::extractor::named_utility_machine::NamedUtilityMachine;
use classification_macros::ClassifyBytes;

#[derive(Debug, Default)]
pub struct UtilityMachine {
    /// Start position of the utility
    start_pos: usize,

    /// Whether the legacy important marker `!` was used
    legacy_important: bool,

    arbitrary_property_machine: ArbitraryPropertyMachine,
    named_utility_machine: NamedUtilityMachine,
    modifier_machine: ModifierMachine,
}

impl Machine for UtilityMachine {
    #[inline(always)]
    fn reset(&mut self) {
        self.start_pos = 0;
        self.legacy_important = false;
    }

    #[inline]
    fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
        match cursor.curr.into() {
            // LEGACY: Important marker
            Class::Exclamation => {
                self.legacy_important = true;

                match cursor.next.into() {
                    // Start of an arbitrary property
                    //
                    // E.g.: `![color:red]`
                    //        ^
                    Class::OpenBracket => {
                        self.start_pos = cursor.pos;
                        cursor.advance();
                        self.parse_arbitrary_property(cursor)
                    }

                    // Start of a named utility
                    //
                    // E.g.: `!flex`
                    //        ^
                    _ => {
                        self.start_pos = cursor.pos;
                        cursor.advance();
                        self.parse_named_utility(cursor)
                    }
                }
            }

            // Start of an arbitrary property
            //
            // E.g.: `[color:red]`
// ... (287 more lines)

Domain

Subdomains

Dependencies

  • classification_macros::ClassifyBytes
  • crate::cursor
  • crate::extractor::arbitrary_property_machine::ArbitraryPropertyMachine
  • crate::extractor::machine::
  • crate::extractor::machine::Machine
  • crate::extractor::modifier_machine::ModifierMachine
  • crate::extractor::named_utility_machine::NamedUtilityMachine
  • pretty_assertions::assert_eq
  • super::UtilityMachine

Frequently Asked Questions

What does utility_machine.rs do?
utility_machine.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, Extractor subdomain.
What functions are defined in utility_machine.rs?
utility_machine.rs defines 8 function(s): next, parse_arbitrary_property, parse_important, parse_modifier, parse_named_utility, reset, test_utility_extraction, test_utility_machine_performance.
What does utility_machine.rs depend on?
utility_machine.rs imports 9 module(s): classification_macros::ClassifyBytes, crate::cursor, crate::extractor::arbitrary_property_machine::ArbitraryPropertyMachine, crate::extractor::machine::, crate::extractor::machine::Machine, crate::extractor::modifier_machine::ModifierMachine, crate::extractor::named_utility_machine::NamedUtilityMachine, pretty_assertions::assert_eq, and 1 more.
Where is utility_machine.rs in the architecture?
utility_machine.rs is located at crates/oxide/src/extractor/utility_machine.rs (domain: OxideEngine, subdomain: Extractor, directory: crates/oxide/src/extractor).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free