Skip to main content

Builder

Struct 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 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 build(&self) -> 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>,

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.