[][src]Struct starship::context::Context

pub struct Context<'a> {
    pub config: Table,
    pub current_dir: PathBuf,
    pub dir_files: Vec<PathBuf>,
    pub arguments: ArgMatches<'a>,
    pub repo_root: Option<PathBuf>,
    pub branch_name: Option<String>,
}

Context contains data or common methods that may be used by multiple modules. The data contained within Context will be relevant to this particular rendering of the prompt.

Fields

config: Table

The deserialized configuration map from the user's starship.toml file.

current_dir: PathBuf

The current working directory that starship is being called in.

dir_files: Vec<PathBuf>

A vector containing the full paths of all the files in current_dir.

arguments: ArgMatches<'a>

The map of arguments that were passed when starship was called.

repo_root: Option<PathBuf>

If current_dir is a git repository or is contained within one, this is the path to the root of that repo.

branch_name: Option<String>

If current_dir is a git repository or is contained within one, this is the current branch name of that repo.

Methods

impl<'a> Context<'a>[src]

pub fn new(arguments: ArgMatches) -> Context[src]

Identify the current working directory and create an instance of Context for it.

pub fn new_with_dir<T>(arguments: ArgMatches, dir: T) -> Context where
    T: Into<PathBuf>, 
[src]

Create a new instance of Context for the provided directory

pub fn new_module(&self, name: &str) -> Option<Module>[src]

Create a new module

Will return None if the module is disabled by configuration, by setting the disabled key to true in the configuration for that module.

pub fn new_scan_dir(&'a self) -> ScanDir<'a>[src]

Auto Trait Implementations

impl<'a> Sync for Context<'a>

impl<'a> Send for Context<'a>

impl<'a> Unpin for Context<'a>

impl<'a> RefUnwindSafe for Context<'a>

impl<'a> UnwindSafe for Context<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self