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 RustCore FileScanner calls 3 called by 2

Entity Profile

Dependency Diagram

graph TD
  e14107a2_1bdc_7eeb_cfd3_5f70e1726e22["extract_candidates()"]
  f393909c_34c9_43c4_59ec_fe5fc5e381be["scan()"]
  f393909c_34c9_43c4_59ec_fe5fc5e381be -->|calls| e14107a2_1bdc_7eeb_cfd3_5f70e1726e22
  380c75f5_fb43_fd76_681b_325ada2a0b31["scan_content()"]
  380c75f5_fb43_fd76_681b_325ada2a0b31 -->|calls| e14107a2_1bdc_7eeb_cfd3_5f70e1726e22
  4571d4dc_ca99_fe60_d6a3_7f055dd490f1["parse_all_blobs()"]
  e14107a2_1bdc_7eeb_cfd3_5f70e1726e22 -->|calls| 4571d4dc_ca99_fe60_d6a3_7f055dd490f1
  7687f3c0_3840_868f_9b32_f85bd015fe14["read_all_files()"]
  e14107a2_1bdc_7eeb_cfd3_5f70e1726e22 -->|calls| 7687f3c0_3840_868f_9b32_f85bd015fe14
  cb0c721d_b70b_57c6_844b_1eb37f21c732["extract_css_variables()"]
  e14107a2_1bdc_7eeb_cfd3_5f70e1726e22 -->|calls| cb0c721d_b70b_57c6_844b_1eb37f21c732
  style e14107a2_1bdc_7eeb_cfd3_5f70e1726e22 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