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
  c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae["matched()"]
  571001a0_ef87_1e6a_2fbf_45da97d1c792["is_empty()"]
  c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae -->|calls| 571001a0_ef87_1e6a_2fbf_45da97d1c792
  3dd644e1_bd83_f8d6_deb1_3a6721424262["unmatched()"]
  c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae -->|calls| 3dd644e1_bd83_f8d6_deb1_3a6721424262
  dd64ec7b_4784_8474_1ab9_bf9c59526cb4["inner()"]
  c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae -->|calls| dd64ec7b_4784_8474_1ab9_bf9c59526cb4
  e3ee7aa4_cfd6_f684_6866_2a6194684ec6["is_negated()"]
  c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae -->|calls| e3ee7aa4_cfd6_f684_6866_2a6194684ec6
  style c26ef4d2_5ec7_7b2b_9cb0_3604871ab8ae 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.
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