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

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

Analyze Your Own Codebase

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

Try Supermodel Free