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

Entity Profile

Dependency Diagram

graph TD
  71d580ee_7b1d_18a6_7e10_fcd29d80bbb7["extract_candidates()"]
  d865d4fd_bb15_6d9a_a900_10e82a6856fb["mod.rs"]
  71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 -->|defined in| d865d4fd_bb15_6d9a_a900_10e82a6856fb
  38bee1fa_4e14_30fb_3457_939e60cb3dd2["scan()"]
  38bee1fa_4e14_30fb_3457_939e60cb3dd2 -->|calls| 71d580ee_7b1d_18a6_7e10_fcd29d80bbb7
  73312877_857d_41ca_363e_e2e1b899efb0["scan_content()"]
  73312877_857d_41ca_363e_e2e1b899efb0 -->|calls| 71d580ee_7b1d_18a6_7e10_fcd29d80bbb7
  e4abe4bd_bf54_17e9_0dc2_bc83afb1e3a5["parse_all_blobs()"]
  71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 -->|calls| e4abe4bd_bf54_17e9_0dc2_bc83afb1e3a5
  ca0dedff_2f53_68d0_8d2b_22ecfa8911d9["read_all_files()"]
  71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 -->|calls| ca0dedff_2f53_68d0_8d2b_22ecfa8911d9
  90127900_ccd6_309f_f962_1776d09d86f4["extract_css_variables()"]
  71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 -->|calls| 90127900_ccd6_309f_f962_1776d09d86f4
  style 71d580ee_7b1d_18a6_7e10_fcd29d80bbb7 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