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 Oxide Extractor 3 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  9f26adf1_a1b8_17f6_8a92_33f30e28ec31["paths.rs"]
  80e34e92_1f22_8e4e_f4b3_71a24f758810["std::fmt::Display"]
  9f26adf1_a1b8_17f6_8a92_33f30e28ec31 --> 80e34e92_1f22_8e4e_f4b3_71a24f758810
  bf49ec6a_d2bc_9f43_93af_d005d022d1e2["std::io"]
  9f26adf1_a1b8_17f6_8a92_33f30e28ec31 --> bf49ec6a_d2bc_9f43_93af_d005d022d1e2
  ac72f7ee_b1a0_3d8a_8e4a_de91e9cb9290["std::path"]
  9f26adf1_a1b8_17f6_8a92_33f30e28ec31 --> ac72f7ee_b1a0_3d8a_8e4a_de91e9cb9290
  style 9f26adf1_a1b8_17f6_8a92_33f30e28ec31 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 Oxide domain, Extractor 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: Oxide, subdomain: Extractor, directory: crates/oxide/src).

Analyze Your Own Codebase

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

Try Supermodel Free