Struct Build

Source
pub struct Build {}
Expand description

Represents the build itself encaspsulating Cargo environment variables

You start the srcript by creating new Build instance which provides further access to project directories and standard Cargo environment variables.

For more info on Cargo environement variables check [Cargo env variables] [Cargo env variables]: https://doc.rust-lang.org/cargo/reference/environment-variables.html

Implementations§

Source§

impl Build

Source

pub fn new() -> Self

Create new Build instance

Source

pub fn current_dir(&self) -> Dir

Current directory where the build has been run from

Source§

impl Build

Accessors for envionment variables set by Cargo when running the script

Source

pub fn cargo_cmd(&self) -> Cmd

Cargo executable command

Source

pub fn rustc_cmd(&self) -> Cmd

Rust compler executable command

Source

pub fn rustc_linker_cmd(&self) -> Cmd

Rust linker executable command

Source

pub fn rustdoc_cmd(&self) -> Cmd

Rust doc executable command

Source

pub fn manifest_dir(&self) -> Dir

Directory containing the project manifest

Project manifest links value

Source

pub fn out_dir(&self) -> Dir

Directory in which all output should be placed

Source

pub fn is_release_build(&self) -> bool

True if cargo profile is release (run with –release)

Source

pub fn has_feature<P: AsRef<str>>(&self, feature: P) -> bool

True if care is being build with feature enabled

Source

pub fn host_triple(&self) -> String

Achitecure triple of the machine running the build

Source

pub fn target_triple(&self) -> String

Achitecure triple of the build binaries

Source

pub fn num_jobs(&self) -> u16

Number of threads to be used by the build

Source

pub fn cfg<P: AsRef<str>>(&self, cfg: P) -> Option<String>

Return configuration (check Cargo documentation above for more info)

Trait Implementations§

Source§

impl Debug for Build

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Build

§

impl RefUnwindSafe for Build

§

impl Send for Build

§

impl Sync for Build

§

impl Unpin for Build

§

impl UnwindSafe for Build

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.