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
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 get_crate_name(&self) -> &str
pub fn get_crate_name(&self) -> &str
Returns the name of the source crate at the construction path
.
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 target
sourcepub fn set_message_format(self, message_format: MessageFormat) -> Self
pub fn set_message_format(self, message_format: MessageFormat) -> Self
Set the message format.
sourcepub fn set_prefix(self, prefix: String) -> Self
pub fn set_prefix(self, prefix: String) -> Self
Set the build command prefix.
sourcepub fn with_env<K: Into<OsString>, V: Into<OsString>>(
self,
key: K,
val: V,
) -> Self
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.
sourcepub fn build(&self) -> Result<BuildStatus<'_>>
pub fn build(&self) -> Result<BuildStatus<'_>>
Performs an actual build: runs cargo
with proper flags and
environment.
sourcepub fn build_live<O: FnMut(&str), E: FnMut(&str)>(
&self,
on_stdout_line: O,
on_stderr_line: E,
) -> Result<BuildStatus<'_>>
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.