rust.rs — tailwindcss Source File
Architecture documentation for rust.rs, a rust file in the tailwindcss codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR b83b130e_f494_4c75_1153_c58b04972660["rust.rs"] a70c89d5_644e_558b_8665_0854ee2c2146["super::Rust"] b83b130e_f494_4c75_1153_c58b04972660 --> a70c89d5_644e_558b_8665_0854ee2c2146 152ed748_080f_19db_956e_a85efc0c6133["crate::extractor::bracket_stack"] b83b130e_f494_4c75_1153_c58b04972660 --> 152ed748_080f_19db_956e_a85efc0c6133 e2b7aac5_02a2_bf5e_9a68_b9cb42045237["crate::extractor::cursor"] b83b130e_f494_4c75_1153_c58b04972660 --> e2b7aac5_02a2_bf5e_9a68_b9cb42045237 9a9673b5_10d4_f716_360c_b2510082b102["crate::extractor::machine::Machine"] b83b130e_f494_4c75_1153_c58b04972660 --> 9a9673b5_10d4_f716_360c_b2510082b102 a55fec3d_3fee_4b46_48f2_43f3844c61e4["crate::extractor::pre_processors::pre_processor::PreProcessor"] b83b130e_f494_4c75_1153_c58b04972660 --> a55fec3d_3fee_4b46_48f2_43f3844c61e4 71141c85_3e46_c613_7ae6_deef432b10a2["crate::extractor::variant_machine::VariantMachine"] b83b130e_f494_4c75_1153_c58b04972660 --> 71141c85_3e46_c613_7ae6_deef432b10a2 5134993b_ea39_eddc_fac7_23c3df329b47["crate::extractor::MachineState"] b83b130e_f494_4c75_1153_c58b04972660 --> 5134993b_ea39_eddc_fac7_23c3df329b47 e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322["bstr::ByteSlice"] b83b130e_f494_4c75_1153_c58b04972660 --> e8f7ef42_4edb_c180_b1a1_7f3dcfa8e322 style b83b130e_f494_4c75_1153_c58b04972660 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
use crate::extractor::bracket_stack;
use crate::extractor::cursor;
use crate::extractor::machine::Machine;
use crate::extractor::pre_processors::pre_processor::PreProcessor;
use crate::extractor::variant_machine::VariantMachine;
use crate::extractor::MachineState;
use bstr::ByteSlice;
#[derive(Debug, Default)]
pub struct Rust;
impl PreProcessor for Rust {
fn process(&self, content: &[u8]) -> Vec<u8> {
// Leptos support: https://github.com/tailwindlabs/tailwindcss/pull/18093
let replaced_content = content
.replace(" class:", " class ")
.replace("\tclass:", " class ")
.replace("\nclass:", " class ");
if replaced_content.contains_str(b"html!") {
self.process_maud_templates(&replaced_content)
} else {
replaced_content
}
}
}
impl Rust {
fn process_maud_templates(&self, replaced_content: &[u8]) -> Vec<u8> {
let len = replaced_content.len();
let mut result = replaced_content.to_vec();
let mut cursor = cursor::Cursor::new(replaced_content);
let mut bracket_stack = bracket_stack::BracketStack::default();
while cursor.pos < len {
match cursor.curr {
// Escaped character, skip ahead to the next character
b'\\' => {
cursor.advance_twice();
continue;
}
// Consume strings as-is
b'"' => {
result[cursor.pos] = b' ';
cursor.advance();
while cursor.pos < len {
match cursor.curr {
// Escaped character, skip ahead to the next character
b'\\' => cursor.advance_twice(),
// End of the string
b'"' => {
result[cursor.pos] = b' ';
break;
}
// Everything else is valid
_ => cursor.advance(),
// ... (157 more lines)
Domain
Subdomains
Dependencies
- bstr::ByteSlice
- crate::extractor::MachineState
- crate::extractor::bracket_stack
- crate::extractor::cursor
- crate::extractor::machine::Machine
- crate::extractor::pre_processors::pre_processor::PreProcessor
- crate::extractor::variant_machine::VariantMachine
- super::Rust
Source
Frequently Asked Questions
What does rust.rs do?
rust.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in rust.rs?
rust.rs defines 4 function(s): process, process_maud_templates, test_leptos_extraction, test_maud_template_extraction.
What does rust.rs depend on?
rust.rs imports 8 module(s): bstr::ByteSlice, crate::extractor::MachineState, crate::extractor::bracket_stack, crate::extractor::cursor, crate::extractor::machine::Machine, crate::extractor::pre_processors::pre_processor::PreProcessor, crate::extractor::variant_machine::VariantMachine, super::Rust.
Where is rust.rs in the architecture?
rust.rs is located at crates/oxide/src/extractor/pre_processors/rust.rs (domain: OxideEngine, subdomain: PreProcessors, directory: crates/oxide/src/extractor/pre_processors).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free