Trait NormalizeStorePath

Source
pub trait NormalizeStorePath {
    type Error;

    // Required method
    fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf, Self::Error>;
}
Expand description

A trait containing a path normalization method, to normalize paths in an Ekala store relative to its root.

Required Associated Types§

Source

type Error

The error type returned by the NormalizeStorePath::normalize function.

Required Methods§

Source

fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf, Self::Error>

Normalizes a given path to be relative to the store root.

This function takes a path (relative or absolute) and attempts to normalize it relative to the store root, based on the current working directory within the store within system.

§Behavior:
  • For relative paths (e.g., “foo/bar” or “../foo”):

    • Interpreted as relative to the current working directory within the repository.
    • Computed relative to the repository root.
  • For absolute paths (e.g., “/foo/bar”):

    • Treated as if the repository root is the filesystem root.
    • The leading slash is ignored, and the path is considered relative to the repo root.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NormalizeStorePath for Repository

Source§

type Error = Error

Source§

fn normalize<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf, Error>

Implementors§