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 Oxide Scanner calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  a3631bf8_302f_3c65_1542_da5537cb94cb["extract_candidates()"]
  b82a42d6_b7d3_c6d2_1e14_451f8382da81["mod.rs"]
  a3631bf8_302f_3c65_1542_da5537cb94cb -->|defined in| b82a42d6_b7d3_c6d2_1e14_451f8382da81
  b6156d89_15ec_7ff3_0888_52940c8f752e["scan()"]
  b6156d89_15ec_7ff3_0888_52940c8f752e -->|calls| a3631bf8_302f_3c65_1542_da5537cb94cb
  fb44373f_ab06_d307_c372_ba0fa0dcfadb["scan_content()"]
  fb44373f_ab06_d307_c372_ba0fa0dcfadb -->|calls| a3631bf8_302f_3c65_1542_da5537cb94cb
  1bae25ce_8b25_8c15_fceb_2406635ea7ee["parse_all_blobs()"]
  a3631bf8_302f_3c65_1542_da5537cb94cb -->|calls| 1bae25ce_8b25_8c15_fceb_2406635ea7ee
  e704cff7_c70b_699c_502e_17660411a27d["read_all_files()"]
  a3631bf8_302f_3c65_1542_da5537cb94cb -->|calls| e704cff7_c70b_699c_502e_17660411a27d
  7e4391a5_fab3_5d95_5e4f_65161614d56c["extract_css_variables()"]
  a3631bf8_302f_3c65_1542_da5537cb94cb -->|calls| 7e4391a5_fab3_5d95_5e4f_65161614d56c
  style a3631bf8_302f_3c65_1542_da5537cb94cb 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, defined in crates/oxide/src/scanner/mod.rs.
Where is extract_candidates() defined?
extract_candidates() is defined in crates/oxide/src/scanner/mod.rs at line 281.
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