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

Entity Profile

Dependency Diagram

graph TD
  e534aa81_6fd8_e24b_3a2a_5ca71f00058f["extract()"]
  b82a42d6_b7d3_c6d2_1e14_451f8382da81["mod.rs"]
  e534aa81_6fd8_e24b_3a2a_5ca71f00058f -->|defined in| b82a42d6_b7d3_c6d2_1e14_451f8382da81
  5676281c_8167_04d8_78a5_361db3b21fc6["get_candidates_with_positions()"]
  5676281c_8167_04d8_78a5_361db3b21fc6 -->|calls| e534aa81_6fd8_e24b_3a2a_5ca71f00058f
  7e4391a5_fab3_5d95_5e4f_65161614d56c["extract_css_variables()"]
  7e4391a5_fab3_5d95_5e4f_65161614d56c -->|calls| e534aa81_6fd8_e24b_3a2a_5ca71f00058f
  1bae25ce_8b25_8c15_fceb_2406635ea7ee["parse_all_blobs()"]
  1bae25ce_8b25_8c15_fceb_2406635ea7ee -->|calls| e534aa81_6fd8_e24b_3a2a_5ca71f00058f
  style e534aa81_6fd8_e24b_3a2a_5ca71f00058f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/oxide/src/scanner/mod.rs lines 527–564

fn extract<H>(blobs: Vec<Vec<u8>>, handle: H) -> Vec<String>
where
    H: Fn(Extractor) -> Vec<Extracted> + std::marker::Sync,
{
    let mut result: Vec<_> = blobs
        .par_iter()
        .flat_map(|blob| blob.par_split(|x| *x == b'\n'))
        .filter_map(|blob| {
            if blob.is_empty() {
                return None;
            }

            let extracted = handle(crate::extractor::Extractor::new(blob));
            if extracted.is_empty() {
                return None;
            }

            Some(FxHashSet::from_iter(extracted.into_iter().map(
                |x| match x {
                    Extracted::Candidate(bytes) => bytes,
                    Extracted::CssVariable(bytes) => bytes,
                },
            )))
        })
        .reduce(Default::default, |mut a, b| {
            a.extend(b);
            a
        })
        .into_iter()
        .map(|s| unsafe { String::from_utf8_unchecked(s.to_vec()) })
        .collect();

    // SAFETY: Unstable sort is faster and in this scenario it's also safe because we are
    //         guaranteed to have unique candidates.
    result.par_sort_unstable();

    result
}

Domain

Subdomains

Frequently Asked Questions

What does extract() do?
extract() is a function in the tailwindcss codebase, defined in crates/oxide/src/scanner/mod.rs.
Where is extract() defined?
extract() is defined in crates/oxide/src/scanner/mod.rs at line 527.
What calls extract()?
extract() is called by 3 function(s): extract_css_variables, get_candidates_with_positions, parse_all_blobs.

Analyze Your Own Codebase

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

Try Supermodel Free