Trait steward::Location

source ·
pub trait Location: Sized + Send + Sync {
    // Required methods
    fn apex() -> Self;
    fn as_path(&self) -> &PathBuf;

    // Provided method
    fn display(&self) -> String { ... }
}
Expand description

A location of file or directory of a project.

It must be implemented by application since it is project specific. See example implementation in the repository.

Required Methods§

source

fn apex() -> Self

Returns a location of the root directory of a project.

It’d be better to call it root but this name left vacant because it’s used often and it’s annoying bringing this trait into a scope everytime Loc::root() needs to be called. This way, users can have root on their implementation and call it by just importing their type.

source

fn as_path(&self) -> &PathBuf

Returns a pointer to an inner path.

Provided Methods§

source

fn display(&self) -> String

Formats a path as a relative to the root directory for printing to console.

Implementors§