extract() — tailwindcss Function Reference
Architecture documentation for the extract() function in mod.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 16a2f09b_5333_b32e_a269_9de80b7dbf37["extract()"] eb5f3ab1_80da_abe4_f35c_a91e8e409b69["mod.rs"] 16a2f09b_5333_b32e_a269_9de80b7dbf37 -->|defined in| eb5f3ab1_80da_abe4_f35c_a91e8e409b69 4479b5e6_f918_ff13_f5d9_2c364621b415["extract_sorted_candidates()"] 4479b5e6_f918_ff13_f5d9_2c364621b415 -->|calls| 16a2f09b_5333_b32e_a269_9de80b7dbf37 087c96ec_f466_7024_7f28_dde67d739914["extract_sorted_css_variables()"] 087c96ec_f466_7024_7f28_dde67d739914 -->|calls| 16a2f09b_5333_b32e_a269_9de80b7dbf37 06a19569_af8d_6742_4209_b8f66ab97091["test_extract_performance()"] 06a19569_af8d_6742_4209_b8f66ab97091 -->|calls| 16a2f09b_5333_b32e_a269_9de80b7dbf37 c9293cb1_2040_7e5e_5fb7_bc4d4028273d["extract_sub_candidates()"] 16a2f09b_5333_b32e_a269_9de80b7dbf37 -->|calls| c9293cb1_2040_7e5e_5fb7_bc4d4028273d ba279df7_48ef_34c8_edd8_25dacccc816e["drop_covered_spans()"] 16a2f09b_5333_b32e_a269_9de80b7dbf37 -->|calls| ba279df7_48ef_34c8_edd8_25dacccc816e style 16a2f09b_5333_b32e_a269_9de80b7dbf37 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/oxide/src/extractor/mod.rs lines 74–141
pub fn extract(&mut self) -> Vec<Extracted<'a>> {
// Candidates found by inner candidate machines. If the outer machine finds a solution, we
// can discard the inner machines. Otherwise, we can keep the candidates from the inner
// machines.
let mut in_flight_spans: Vec<Span> = Vec::with_capacity(15);
// All the extracted values
let mut extracted = Vec::with_capacity(100);
let len = self.cursor.input.len();
// CSS Variable extractor
{
let cursor = &mut self.cursor.clone();
while cursor.pos < len {
if cursor.curr.is_ascii_whitespace() {
cursor.advance();
continue;
}
if let MachineState::Done(span) = self.css_variable_machine.next(cursor) {
extracted.push(Extracted::CssVariable(span.slice(self.cursor.input)));
}
cursor.advance();
}
}
// Candidate extractor
{
let cursor = &mut self.cursor.clone();
while cursor.pos < len {
if cursor.curr.is_ascii_whitespace() {
cursor.advance();
continue;
}
let before = cursor.pos;
match self.candidate_machine.next(cursor) {
MachineState::Done(span) => {
in_flight_spans.push(span);
extract_sub_candidates(before..span.start, cursor, &mut in_flight_spans);
}
MachineState::Idle => {
extract_sub_candidates(
before..cursor.pos.min(cursor.input.len()),
cursor,
&mut in_flight_spans,
);
}
}
cursor.advance();
}
// Commit the remaining in-flight spans as extracted candidates
if !in_flight_spans.is_empty() {
extracted.extend(
drop_covered_spans(in_flight_spans)
.iter()
.map(|span| Extracted::Candidate(span.slice(self.cursor.input))),
);
}
}
extracted
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does extract() do?
extract() is a function in the tailwindcss codebase, defined in crates/oxide/src/extractor/mod.rs.
Where is extract() defined?
extract() is defined in crates/oxide/src/extractor/mod.rs at line 74.
What does extract() call?
extract() calls 2 function(s): drop_covered_spans, extract_sub_candidates.
What calls extract()?
extract() is called by 3 function(s): extract_sorted_candidates, extract_sorted_css_variables, test_extract_performance.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free