Home / Function/ extract() — tailwindcss Function Reference

extract() — tailwindcss Function Reference

Architecture documentation for the extract() function in mod.rs from the tailwindcss codebase.

Function rust OxideCore Extractor calls 6 called by 3

Entity Profile

Dependency Diagram

graph TD
  2a34bbb8_098e_f736_c9a4_821aa310393f["extract()"]
  8f2e8263_71a9_a049_0c91_be243b9ddd77["extract_sorted_candidates()"]
  8f2e8263_71a9_a049_0c91_be243b9ddd77 -->|calls| 2a34bbb8_098e_f736_c9a4_821aa310393f
  c1f434c4_69e7_c910_6327_9cd64fa4afbf["extract_sorted_css_variables()"]
  c1f434c4_69e7_c910_6327_9cd64fa4afbf -->|calls| 2a34bbb8_098e_f736_c9a4_821aa310393f
  98826bc7_7038_2e4e_1e77_9af53a024299["test_extract_performance()"]
  98826bc7_7038_2e4e_1e77_9af53a024299 -->|calls| 2a34bbb8_098e_f736_c9a4_821aa310393f
  35b2adf8_a27b_5aee_3865_21fb048c97fb["advance()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| 35b2adf8_a27b_5aee_3865_21fb048c97fb
  0d2f4bc0_2b1b_fd72_0ffc_954eed604d0a["push()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| 0d2f4bc0_2b1b_fd72_0ffc_954eed604d0a
  d2bddcc9_51f0_bdb4_7adc_98bf017751d8["slice()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| d2bddcc9_51f0_bdb4_7adc_98bf017751d8
  42310c9d_2680_b572_ccde_1fbbe4d1455a["extract_sub_candidates()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| 42310c9d_2680_b572_ccde_1fbbe4d1455a
  137d4a53_4b6e_09a1_8799_98b67760e503["is_empty()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| 137d4a53_4b6e_09a1_8799_98b67760e503
  4f8e94b3_3738_d6ce_d93e_5eec85fa053f["drop_covered_spans()"]
  2a34bbb8_098e_f736_c9a4_821aa310393f -->|calls| 4f8e94b3_3738_d6ce_d93e_5eec85fa053f
  style 2a34bbb8_098e_f736_c9a4_821aa310393f 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

Frequently Asked Questions

What does extract() do?
extract() is a function in the tailwindcss codebase.
What does extract() call?
extract() calls 6 function(s): advance, drop_covered_spans, extract_sub_candidates, is_empty, push, slice.
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