Struct ptx_builder::builder::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

Core of the crate - PTX assembly build controller.

Implementations§

source§

impl Builder

source

pub fn new<P: AsRef<Path>>(path: P) -> Result<Self>

Construct a builder for device crate at path.

Can also be the same crate, for single-source mode:

use ptx_builder::prelude::*;

match Builder::new(".")?.build()? {
    BuildStatus::Success(output) => {
        // do something with the output...
    }

    BuildStatus::NotNeeded => {
        // ...
    }
}
source

pub fn is_build_needed() -> bool

Returns bool indicating whether the actual build is needed.

Behavior is consistent with BuildStatus::NotNeeded.

source

pub fn get_crate_name(&self) -> &str

Returns the name of the source crate at the construction path.

source

pub fn disable_colors(self) -> Self

Disable colors for internal calls to cargo.

source

pub fn set_profile(self, profile: Profile) -> Self

Set build profile.

source

pub fn set_crate_type(self, crate_type: CrateType) -> Self

Set crate type that needs to be built.

Mandatory for mixed crates - that have both lib.rs and main.rs, otherwise Cargo won’t know which to build:

error: extra arguments to `rustc` can only be passed to one target, consider filtering
the package by passing e.g. `--lib` or `--bin NAME` to specify a single target
source

pub fn set_message_format(self, message_format: MessageFormat) -> Self

Set the message format.

source

pub fn set_prefix(self, prefix: String) -> Self

Set the build command prefix.

source

pub fn with_env<K: Into<OsString>, V: Into<OsString>>( self, key: K, val: V, ) -> Self

Inserts or updates an environment variable for the build process.

source

pub fn build(&self) -> Result<BuildStatus<'_>>

Performs an actual build: runs cargo with proper flags and environment.

source

pub fn build_live<O: FnMut(&str), E: FnMut(&str)>( &self, on_stdout_line: O, on_stderr_line: E, ) -> Result<BuildStatus<'_>>

Performs an actual build: runs cargo with proper flags and environment.

Trait Implementations§

source§

impl Debug for Builder

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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

§

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.