pub struct Builder { /* private fields */ }Expand description
Core of the crate - PTX assembly build controller.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self>
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 => {
// ...
}
}Sourcepub fn is_build_needed() -> bool
pub fn is_build_needed() -> bool
Returns bool indicating whether the actual build is needed.
Behavior is consistent with
BuildStatus::NotNeeded.
Sourcepub fn disable_colors(self) -> Self
pub fn disable_colors(self) -> Self
Disable colors for internal calls to cargo.
Sourcepub fn set_profile(self, profile: Profile) -> Self
pub fn set_profile(self, profile: Profile) -> Self
Set build profile.
Sourcepub fn set_crate_type(self, crate_type: CrateType) -> Self
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 targetSourcepub fn build(&self) -> Result<BuildStatus<'_>>
pub fn build(&self) -> Result<BuildStatus<'_>>
Performs an actual build: runs cargo with proper flags and environment.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more