Home / Function/ extract_candidates() — tailwindcss Function Reference

extract_candidates() — tailwindcss Function Reference

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

Function rust OxideCore Scanner calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  c89b240d_593b_77f4_98be_01fdb9aae54a["extract_candidates()"]
  89b17e28_39e8_3896_8c5e_c9b6a2860e73["scan()"]
  89b17e28_39e8_3896_8c5e_c9b6a2860e73 -->|calls| c89b240d_593b_77f4_98be_01fdb9aae54a
  2bc8752c_2d18_82ed_b1a3_715585f5e9a3["scan_content()"]
  2bc8752c_2d18_82ed_b1a3_715585f5e9a3 -->|calls| c89b240d_593b_77f4_98be_01fdb9aae54a
  e61e4bec_63c8_a3d9_0f83_d9ddcc055c47["parse_all_blobs()"]
  c89b240d_593b_77f4_98be_01fdb9aae54a -->|calls| e61e4bec_63c8_a3d9_0f83_d9ddcc055c47
  802385f8_f025_d4fc_5a2f_45e3e67d119a["read_all_files()"]
  c89b240d_593b_77f4_98be_01fdb9aae54a -->|calls| 802385f8_f025_d4fc_5a2f_45e3e67d119a
  13c697bf_449d_2ac5_439a_211d8945d721["extract_css_variables()"]
  c89b240d_593b_77f4_98be_01fdb9aae54a -->|calls| 13c697bf_449d_2ac5_439a_211d8945d721
  style c89b240d_593b_77f4_98be_01fdb9aae54a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/scanner/mod.rs lines 281–313

    fn extract_candidates(&mut self) -> Vec<String> {
        let changed_content = self.changed_content.drain(..).collect::<Vec<_>>();

        // Extract all candidates from the changed content
        let mut new_candidates = parse_all_blobs(read_all_files(changed_content));

        // Extract all CSS variables from the CSS files
        let css_files = self.css_files.drain(..).collect::<Vec<_>>();
        if !css_files.is_empty() {
            let css_variables = extract_css_variables(read_all_files(
                css_files
                    .into_iter()
                    .map(|file| ChangedContent::File(file, "css".into()))
                    .collect(),
            ));

            new_candidates.extend(css_variables);
        }

        // Only compute the new candidates and ignore the ones we already have. This is for
        // subsequent calls to prevent serializing the entire set of candidates every time.
        let mut new_candidates = new_candidates
            .into_par_iter()
            .filter(|candidate| !self.candidates.contains(candidate))
            .collect::<Vec<_>>();

        new_candidates.par_sort_unstable();

        // Track new candidates for subsequent calls
        self.candidates.par_extend(new_candidates.clone());

        new_candidates
    }

Domain

Subdomains

Frequently Asked Questions

What does extract_candidates() do?
extract_candidates() is a function in the tailwindcss codebase.
What does extract_candidates() call?
extract_candidates() calls 3 function(s): extract_css_variables, parse_all_blobs, read_all_files.
What calls extract_candidates()?
extract_candidates() is called by 2 function(s): scan, scan_content.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free