add_def() — tailwindcss Function Reference
Architecture documentation for the add_def() function in types.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD c44bc084_0502_5ec6_d31b_778984e899f7["add_def()"] 08edba3a_006b_c0f4_caba_f2d75c8302a3["types.rs"] c44bc084_0502_5ec6_d31b_778984e899f7 -->|defined in| 08edba3a_006b_c0f4_caba_f2d75c8302a3 ae382f2c_54cb_6e9d_6f2a_9cca6dc3c17d["test_invalid_defs()"] ae382f2c_54cb_6e9d_6f2a_9cca6dc3c17d -->|calls| c44bc084_0502_5ec6_d31b_778984e899f7 ee16d84a_29ba_2ed4_6b77_5ed885459c52["add()"] c44bc084_0502_5ec6_d31b_778984e899f7 -->|calls| ee16d84a_29ba_2ed4_6b77_5ed885459c52 59694fd3_63f6_651e_7e8e_fa69e1da5ae1["len()"] c44bc084_0502_5ec6_d31b_778984e899f7 -->|calls| 59694fd3_63f6_651e_7e8e_fa69e1da5ae1 386a1001_7188_cd1c_0acf_547406cd9f6c["is_empty()"] c44bc084_0502_5ec6_d31b_778984e899f7 -->|calls| 386a1001_7188_cd1c_0acf_547406cd9f6c style c44bc084_0502_5ec6_d31b_778984e899f7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/ignore/src/types.rs lines 442–475
pub fn add_def(&mut self, def: &str) -> Result<(), Error> {
let parts: Vec<&str> = def.split(':').collect();
match parts.len() {
2 => {
let name = parts[0];
let glob = parts[1];
if name.is_empty() || glob.is_empty() {
return Err(Error::InvalidDefinition);
}
self.add(name, glob)
}
3 => {
let name = parts[0];
let types_string = parts[2];
if name.is_empty() || parts[1] != "include" || types_string.is_empty() {
return Err(Error::InvalidDefinition);
}
let types = types_string.split(',');
// Check ahead of time to ensure that all types specified are
// present and fail fast if not.
if types.clone().any(|t| !self.types.contains_key(t)) {
return Err(Error::InvalidDefinition);
}
for type_name in types {
let globs = self.types.get(type_name).unwrap().globs.clone();
for glob in globs {
self.add(name, &glob)?;
}
}
Ok(())
}
_ => Err(Error::InvalidDefinition),
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does add_def() do?
add_def() is a function in the tailwindcss codebase, defined in crates/ignore/src/types.rs.
Where is add_def() defined?
add_def() is defined in crates/ignore/src/types.rs at line 442.
What does add_def() call?
add_def() calls 3 function(s): add, is_empty, len.
What calls add_def()?
add_def() is called by 1 function(s): test_invalid_defs.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free