Home / Function/ strip_prefix() — tailwindcss Function Reference

strip_prefix() — tailwindcss Function Reference

Architecture documentation for the strip_prefix() function in pathutil.rs from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  b29b6c41_5a46_6cec_e1be_f704a0020722["strip_prefix()"]
  5a63fc5c_8a1d_dad2_626b_d01b587f0205["pathutil.rs"]
  b29b6c41_5a46_6cec_e1be_f704a0020722 -->|defined in| 5a63fc5c_8a1d_dad2_626b_d01b587f0205
  style b29b6c41_5a46_6cec_e1be_f704a0020722 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/pathutil.rs lines 63–76

pub(crate) fn strip_prefix<'a, P: AsRef<Path> + ?Sized>(
    prefix: &'a P,
    path: &'a Path,
) -> Option<&'a Path> {
    use std::os::unix::ffi::OsStrExt;

    let prefix = prefix.as_ref().as_os_str().as_bytes();
    let path = path.as_os_str().as_bytes();
    if prefix.len() > path.len() || prefix != &path[0..prefix.len()] {
        None
    } else {
        Some(&Path::new(OsStr::from_bytes(&path[prefix.len()..])))
    }
}

Domain

Subdomains

Frequently Asked Questions

What does strip_prefix() do?
strip_prefix() is a function in the tailwindcss codebase, defined in crates/ignore/src/pathutil.rs.
Where is strip_prefix() defined?
strip_prefix() is defined in crates/ignore/src/pathutil.rs at line 63.

Analyze Your Own Codebase

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

Try Supermodel Free