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
  83c1cf25_5cf6_491c_52fb_238dd315fe82["matched()"]
  08edba3a_006b_c0f4_caba_f2d75c8302a3["types.rs"]
  83c1cf25_5cf6_491c_52fb_238dd315fe82 -->|defined in| 08edba3a_006b_c0f4_caba_f2d75c8302a3
  386a1001_7188_cd1c_0acf_547406cd9f6c["is_empty()"]
  83c1cf25_5cf6_491c_52fb_238dd315fe82 -->|calls| 386a1001_7188_cd1c_0acf_547406cd9f6c
  45069181_9b8f_41b2_4fc7_09c56fe8a8d6["unmatched()"]
  83c1cf25_5cf6_491c_52fb_238dd315fe82 -->|calls| 45069181_9b8f_41b2_4fc7_09c56fe8a8d6
  22082b24_ea7c_e755_8d7f_c0d58ff74fff["inner()"]
  83c1cf25_5cf6_491c_52fb_238dd315fe82 -->|calls| 22082b24_ea7c_e755_8d7f_c0d58ff74fff
  cfa1a6c9_a14b_ae71_b5c4_546b2c9add47["is_negated()"]
  83c1cf25_5cf6_491c_52fb_238dd315fe82 -->|calls| cfa1a6c9_a14b_ae71_b5c4_546b2c9add47
  style 83c1cf25_5cf6_491c_52fb_238dd315fe82 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