Home / File/ variant_machine.rs — tailwindcss Source File

variant_machine.rs — tailwindcss Source File

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

File rust OxideEngine Extractor 8 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  65f88ee5_a242_be7c_fc9b_70da07dd6b00["variant_machine.rs"]
  0696f4f1_2844_0440_b88d_d4643d9ed076["super::VariantMachine"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> 0696f4f1_2844_0440_b88d_d4643d9ed076
  e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e["crate::cursor"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> e4e20bdf_ad1e_e4a0_5cba_d0f5a5db787e
  b60f51a6_6e97_8e3d_707d_9068f03871c1["crate::extractor::arbitrary_value_machine::ArbitraryValueMachine"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> b60f51a6_6e97_8e3d_707d_9068f03871c1
  cd83abb6_a664_e16d_ddc8_60a3f23ba86a["crate::extractor::machine::"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> cd83abb6_a664_e16d_ddc8_60a3f23ba86a
  376f9bad_1742_8325_fe05_c8c3e1a992bd["crate::extractor::named_variant_machine::NamedVariantMachine"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> 376f9bad_1742_8325_fe05_c8c3e1a992bd
  5731c53a_0325_b3af_2918_bcb379bc8ec6["classification_macros::ClassifyBytes"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> 5731c53a_0325_b3af_2918_bcb379bc8ec6
  9a9673b5_10d4_f716_360c_b2510082b102["crate::extractor::machine::Machine"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> 9a9673b5_10d4_f716_360c_b2510082b102
  e4088d34_b5b4_ec51_b975_557a1536ec76["pretty_assertions::assert_eq"]
  65f88ee5_a242_be7c_fc9b_70da07dd6b00 --> e4088d34_b5b4_ec51_b975_557a1536ec76
  style 65f88ee5_a242_be7c_fc9b_70da07dd6b00 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use crate::cursor;
use crate::extractor::arbitrary_value_machine::ArbitraryValueMachine;
use crate::extractor::machine::{Machine, MachineState};
use crate::extractor::named_variant_machine::NamedVariantMachine;
use classification_macros::ClassifyBytes;

#[derive(Debug, Default)]
pub struct VariantMachine {
    arbitrary_value_machine: ArbitraryValueMachine,
    named_variant_machine: NamedVariantMachine,
}

impl Machine for VariantMachine {
    #[inline(always)]
    fn reset(&mut self) {}

    #[inline]
    fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
        match cursor.curr.into() {
            // Start of an arbitrary variant
            //
            // E.g.: `[&:hover]:`
            //        ^
            Class::OpenBracket => {
                let start_pos = cursor.pos;
                match self.arbitrary_value_machine.next(cursor) {
                    MachineState::Idle => self.restart(),
                    MachineState::Done(_) => self.parse_arbitrary_end(start_pos, cursor),
                }
            }

            // Start of a named variant
            _ => {
                let start_pos = cursor.pos;
                match self.named_variant_machine.next(cursor) {
                    MachineState::Idle => self.restart(),
                    MachineState::Done(_) => self.done(start_pos, cursor),
                }
            }
        }
    }
}

impl VariantMachine {
    #[inline(always)]
    fn parse_arbitrary_end(
        &mut self,
        start_pos: usize,
        cursor: &mut cursor::Cursor<'_>,
    ) -> MachineState {
        match cursor.next.into() {
            // End of an arbitrary value, must be followed by a `:`
            //
            // E.g.: `[&:hover]:`
            //                 ^
            Class::Colon => {
                cursor.advance();
                self.done(start_pos, cursor)
            }

// ... (87 more lines)

Domain

Subdomains

Dependencies

  • classification_macros::ClassifyBytes
  • crate::cursor
  • crate::extractor::arbitrary_value_machine::ArbitraryValueMachine
  • crate::extractor::machine::
  • crate::extractor::machine::Machine
  • crate::extractor::named_variant_machine::NamedVariantMachine
  • pretty_assertions::assert_eq
  • super::VariantMachine

Frequently Asked Questions

What does variant_machine.rs do?
variant_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 variant_machine.rs?
variant_machine.rs defines 5 function(s): next, parse_arbitrary_end, reset, test_variant_extraction, test_variant_machine_performance.
What does variant_machine.rs depend on?
variant_machine.rs imports 8 module(s): classification_macros::ClassifyBytes, crate::cursor, crate::extractor::arbitrary_value_machine::ArbitraryValueMachine, crate::extractor::machine::, crate::extractor::machine::Machine, crate::extractor::named_variant_machine::NamedVariantMachine, pretty_assertions::assert_eq, super::VariantMachine.
Where is variant_machine.rs in the architecture?
variant_machine.rs is located at crates/oxide/src/extractor/variant_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