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
  f35f67ab_7b07_4873_e851_faf64dccd81a["matched()"]
  da3d6be8_60b5_8c84_ce8d_7f1ce6a7c06b["is_empty()"]
  f35f67ab_7b07_4873_e851_faf64dccd81a -->|calls| da3d6be8_60b5_8c84_ce8d_7f1ce6a7c06b
  33faacd3_61f3_f142_22ad_36a022ca1968["unmatched()"]
  f35f67ab_7b07_4873_e851_faf64dccd81a -->|calls| 33faacd3_61f3_f142_22ad_36a022ca1968
  cf19b3df_a286_d193_0e84_2094721fbdc0["inner()"]
  f35f67ab_7b07_4873_e851_faf64dccd81a -->|calls| cf19b3df_a286_d193_0e84_2094721fbdc0
  0ee942dd_5bdb_6edf_28ba_920ff765aae9["is_negated()"]
  f35f67ab_7b07_4873_e851_faf64dccd81a -->|calls| 0ee942dd_5bdb_6edf_28ba_920ff765aae9
  style f35f67ab_7b07_4873_e851_faf64dccd81a 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
        }
    }

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