variant_machine.rs — tailwindcss Source File
Architecture documentation for variant_machine.rs, a rust file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 741df9fe_696f_ca77_27e8_852abda4bc50["variant_machine.rs"] 1510c98f_fffb_f5d7_3344_8b4fa44f5e9d["super::VariantMachine"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 1510c98f_fffb_f5d7_3344_8b4fa44f5e9d 96a36755_a007_15e1_ec6c_526c02d24b9b["crate::cursor"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 96a36755_a007_15e1_ec6c_526c02d24b9b ec3c2d9b_617f_ce45_34ee_554128afd65f["crate::extractor::arbitrary_value_machine::ArbitraryValueMachine"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> ec3c2d9b_617f_ce45_34ee_554128afd65f 05907c18_a40e_a5a9_c7c3_5faba98e1e87["crate::extractor::machine::"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 05907c18_a40e_a5a9_c7c3_5faba98e1e87 24bf52a6_b9d7_c735_b0a5_86a0d79d3e11["crate::extractor::named_variant_machine::NamedVariantMachine"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 24bf52a6_b9d7_c735_b0a5_86a0d79d3e11 7a907858_c7d2_db19_0e89_e3d1d2242e48["classification_macros::ClassifyBytes"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 7a907858_c7d2_db19_0e89_e3d1d2242e48 4d153f79_f78b_b66c_1e8a_11a0eb99bd41["crate::extractor::machine::Machine"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 4d153f79_f78b_b66c_1e8a_11a0eb99bd41 433675ca_8d0e_feff_42a5_b3f666878cca["pretty_assertions::assert_eq"] 741df9fe_696f_ca77_27e8_852abda4bc50 --> 433675ca_8d0e_feff_42a5_b3f666878cca style 741df9fe_696f_ca77_27e8_852abda4bc50 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
Functions
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
Source
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 Oxide 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: Oxide, 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