Home / Function/ matched() — tailwindcss Function Reference

matched() — tailwindcss Function Reference

Architecture documentation for the matched() function in types.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  144fa79e_efce_f80f_23ac_35b4796bd975["matched()"]
  d51c6497_c250_cc24_5922_420f8b0354f8["types.rs"]
  144fa79e_efce_f80f_23ac_35b4796bd975 -->|defined in| d51c6497_c250_cc24_5922_420f8b0354f8
  e22e74dd_21e9_9af3_dc5a_7c8fdaa86049["is_empty()"]
  144fa79e_efce_f80f_23ac_35b4796bd975 -->|calls| e22e74dd_21e9_9af3_dc5a_7c8fdaa86049
  1f6dc641_267c_9a73_591c_c9bb141923a5["unmatched()"]
  144fa79e_efce_f80f_23ac_35b4796bd975 -->|calls| 1f6dc641_267c_9a73_591c_c9bb141923a5
  99fa4404_4910_3aa6_2739_897608ef5498["inner()"]
  144fa79e_efce_f80f_23ac_35b4796bd975 -->|calls| 99fa4404_4910_3aa6_2739_897608ef5498
  14c53869_655f_0e34_fb94_487d2ea4f442["is_negated()"]
  144fa79e_efce_f80f_23ac_35b4796bd975 -->|calls| 14c53869_655f_0e34_fb94_487d2ea4f442
  style 144fa79e_efce_f80f_23ac_35b4796bd975 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/types.rs lines 257–292

    pub fn matched<'a, P: AsRef<Path>>(&'a self, path: P, is_dir: bool) -> Match<Glob<'a>> {
        // File types don't apply to directories, and we can't do anything
        // if our glob set is empty.
        if is_dir || self.set.is_empty() {
            return Match::None;
        }
        // We only want to match against the file name, so extract it.
        // If one doesn't exist, then we can't match it.
        let name = match file_name(path.as_ref()) {
            Some(name) => name,
            None if self.has_selected => {
                return Match::Ignore(Glob::unmatched());
            }
            None => {
                return Match::None;
            }
        };
        let mut matches = self.matches.get();
        self.set.matches_into(name, &mut *matches);
        // The highest precedent match is the last one.
        if let Some(&i) = matches.last() {
            let (isel, _) = self.glob_to_selection[i];
            let sel = &self.selections[isel];
            let glob = Glob(GlobInner::Matched { def: sel.inner() });
            return if sel.is_negated() {
                Match::Ignore(glob)
            } else {
                Match::Whitelist(glob)
            };
        }
        if self.has_selected {
            Match::Ignore(Glob::unmatched())
        } else {
            Match::None
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does matched() do?
matched() is a function in the tailwindcss codebase, defined in crates/ignore/src/types.rs.
Where is matched() defined?
matched() is defined in crates/ignore/src/types.rs at line 257.
What does matched() call?
matched() calls 4 function(s): inner, is_empty, is_negated, unmatched.

Analyze Your Own Codebase

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

Try Supermodel Free