extract() — tailwindcss Function Reference
Architecture documentation for the extract() function in mod.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 2e1301fe_658a_5bf1_3e5d_7a64079b8218["extract()"] 0fcd0fda_f6d1_052f_9575_133f5b2763a7["mod.rs"] 2e1301fe_658a_5bf1_3e5d_7a64079b8218 -->|defined in| 0fcd0fda_f6d1_052f_9575_133f5b2763a7 71451c19_80d4_2ea2_194b_8cfb0de28a9e["extract_sorted_candidates()"] 71451c19_80d4_2ea2_194b_8cfb0de28a9e -->|calls| 2e1301fe_658a_5bf1_3e5d_7a64079b8218 36616825_cb16_f450_d81a_a465e251e3c5["extract_sorted_css_variables()"] 36616825_cb16_f450_d81a_a465e251e3c5 -->|calls| 2e1301fe_658a_5bf1_3e5d_7a64079b8218 c2a6e46a_e108_8d84_7e8a_8a8124ecebf3["test_extract_performance()"] c2a6e46a_e108_8d84_7e8a_8a8124ecebf3 -->|calls| 2e1301fe_658a_5bf1_3e5d_7a64079b8218 9671ea6a_5fe8_c478_46e3_657f17ef59a1["extract_sub_candidates()"] 2e1301fe_658a_5bf1_3e5d_7a64079b8218 -->|calls| 9671ea6a_5fe8_c478_46e3_657f17ef59a1 a8606bf3_fb98_6dbb_596c_00eaf627bb81["drop_covered_spans()"] 2e1301fe_658a_5bf1_3e5d_7a64079b8218 -->|calls| a8606bf3_fb98_6dbb_596c_00eaf627bb81 style 2e1301fe_658a_5bf1_3e5d_7a64079b8218 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