Enum ra_ap_toolchain::Tool

source ·
pub enum Tool {
    Cargo,
    Rustc,
    Rustup,
    Rustfmt,
}

Variants§

§

Cargo

§

Rustc

§

Rustup

§

Rustfmt

Implementations§

source§

impl Tool

source

pub fn proxy(self) -> Option<Utf8PathBuf>

source

pub fn prefer_proxy(self) -> Utf8PathBuf

Return a PathBuf to use for the given executable.

The current implementation checks three places for an executable to use:

  1. $CARGO_HOME/bin/<executable_name> where $CARGO_HOME defaults to ~/.cargo (see https://doc.rust-lang.org/cargo/guide/cargo-home.html) example: for cargo, this tries $CARGO_HOME/bin/cargo, or ~/.cargo/bin/cargo if $CARGO_HOME is unset. It seems that this is a reasonable place to try for cargo, rustc, and rustup
  2. Appropriate environment variable (erroring if this is set but not a usable executable) example: for cargo, this checks $CARGO environment variable; for rustc, $RUSTC; etc
  3. $PATH/<executable_name> example: for cargo, this tries all paths in $PATH with appended cargo, returning the first that exists
  4. If all else fails, we just try to use the executable name directly
source

pub fn path(self) -> Utf8PathBuf

Return a PathBuf to use for the given executable.

The current implementation checks three places for an executable to use:

  1. Appropriate environment variable (erroring if this is set but not a usable executable) example: for cargo, this checks $CARGO environment variable; for rustc, $RUSTC; etc
  2. $PATH/<executable_name> example: for cargo, this tries all paths in $PATH with appended cargo, returning the first that exists
  3. $CARGO_HOME/bin/<executable_name> where $CARGO_HOME defaults to ~/.cargo (see https://doc.rust-lang.org/cargo/guide/cargo-home.html) example: for cargo, this tries $CARGO_HOME/bin/cargo, or ~/.cargo/bin/cargo if $CARGO_HOME is unset. It seems that this is a reasonable place to try for cargo, rustc, and rustup
  4. If all else fails, we just try to use the executable name directly
source

pub fn path_in(self, path: &Utf8Path) -> Option<Utf8PathBuf>

source

pub fn name(self) -> &'static str

Trait Implementations§

source§

impl Clone for Tool

source§

fn clone(&self) -> Tool

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Copy for Tool

Auto Trait Implementations§

§

impl Freeze for Tool

§

impl RefUnwindSafe for Tool

§

impl Send for Tool

§

impl Sync for Tool

§

impl Unpin for Tool

§

impl UnwindSafe for Tool

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.