Home / File/ paths.rs — tailwindcss Source File

paths.rs — tailwindcss Source File

Architecture documentation for paths.rs, a rust file in the tailwindcss codebase. 3 imports, 0 dependents.

File rust OxideEngine PreProcessors 3 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  73d70c3b_3308_60ac_2c74_087d0099e210["paths.rs"]
  32d0df29_52be_cb16_c3a0_4a75bfcddaaf["std::fmt::Display"]
  73d70c3b_3308_60ac_2c74_087d0099e210 --> 32d0df29_52be_cb16_c3a0_4a75bfcddaaf
  4dcb9b3f_e4f2_cb56_c7c0_31d3b2c02e6e["std::io"]
  73d70c3b_3308_60ac_2c74_087d0099e210 --> 4dcb9b3f_e4f2_cb56_c7c0_31d3b2c02e6e
  1efb3844_4462_e4ab_37b0_6304024721ff["std::path"]
  73d70c3b_3308_60ac_2c74_087d0099e210 --> 1efb3844_4462_e4ab_37b0_6304024721ff
  style 73d70c3b_3308_60ac_2c74_087d0099e210 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

use std::fmt::Display;
use std::io;
use std::path;

#[derive(Clone)]
pub struct Path {
    inner: path::PathBuf,
}

impl From<path::PathBuf> for Path {
    fn from(value: path::PathBuf) -> Self {
        Self { inner: value }
    }
}

impl From<String> for Path {
    fn from(value: String) -> Self {
        Self {
            inner: value.into(),
        }
    }
}

impl From<&str> for Path {
    fn from(value: &str) -> Self {
        Self {
            inner: value.into(),
        }
    }
}

impl Display for Path {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "{}",
            format!("{}", self.inner.display()).replace('\\', "/")
        )
    }
}

impl Path {
    pub fn trim_prefix(&self, prefix: String) -> Self {
        let prefix = prefix.replace('\\', "/");
        let my_path = self.to_string();

        if let Some(str) = my_path.strip_prefix(&prefix) {
            return str.into();
        }

        my_path.into()
    }

    pub fn join(&self, component: &str) -> Self {
        if component.is_empty() {
            return self.clone();
        }

        self.inner.join(component).into()
    }

    pub fn canonicalize(&self) -> io::Result<Self> {
        Ok(dunce::canonicalize(&self.inner)?.into())
    }
}

Domain

Subdomains

Dependencies

  • std::fmt::Display
  • std::io
  • std::path

Frequently Asked Questions

What does paths.rs do?
paths.rs is a source file in the tailwindcss codebase, written in rust. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in paths.rs?
paths.rs defines 5 function(s): canonicalize, fmt, from, join, trim_prefix.
What does paths.rs depend on?
paths.rs imports 3 module(s): std::fmt::Display, std::io, std::path.
Where is paths.rs in the architecture?
paths.rs is located at crates/oxide/src/paths.rs (domain: OxideEngine, subdomain: PreProcessors, directory: crates/oxide/src).

Analyze Your Own Codebase

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

Try Supermodel Free