pub struct RustBuilder { /* private fields */ }Expand description
Builder for Rust project compilation with smart defaults.
Discovers Cargo.toml by walking up from the starting path, parses project metadata, and provides methods to build and copy binaries to ~/hero/bin.
Implementations§
Source§impl RustBuilder
impl RustBuilder
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Self
pub fn from_path<P: AsRef<Path>>(path: P) -> Self
Creates a new RustBuilder starting from the given path. The path can be a file or directory - will walk up to find Cargo.toml.
Sourcepub fn profile(self, profile: BuildProfile) -> Self
pub fn profile(self, profile: BuildProfile) -> Self
Sets the build profile.
Sourcepub fn all_features(self) -> Self
pub fn all_features(self) -> Self
Enable all features.
Sourcepub fn no_default_features(self) -> Self
pub fn no_default_features(self) -> Self
Disable default features.
Sourcepub fn copy_to_hero_bin(self) -> Self
pub fn copy_to_hero_bin(self) -> Self
Copy the built binary to ~/hero/bin after successful build. Removes existing file at destination before copying.
Sourcepub fn output_dir<P: AsRef<Path>>(self, path: P) -> Self
pub fn output_dir<P: AsRef<Path>>(self, path: P) -> Self
Set a custom output directory for copying (instead of /hero/bin).
Tilde () in paths will be expanded to home directory.
Sourcepub fn discover(&mut self) -> BuilderResult<&CargoMetadata>
pub fn discover(&mut self) -> BuilderResult<&CargoMetadata>
Discovers Cargo.toml and parses metadata. Called automatically by build() if not called explicitly.
Sourcepub fn cargo_toml_path(&self) -> Option<&Path>
pub fn cargo_toml_path(&self) -> Option<&Path>
Returns the path to Cargo.toml (after discovery).
Sourcepub fn project_root(&self) -> Option<&Path>
pub fn project_root(&self) -> Option<&Path>
Returns the project root directory (parent of Cargo.toml).
Sourcepub fn metadata(&self) -> Option<&CargoMetadata>
pub fn metadata(&self) -> Option<&CargoMetadata>
Returns parsed cargo metadata (after discovery).
Sourcepub fn list_binaries(&mut self) -> BuilderResult<Vec<BinaryTarget>>
pub fn list_binaries(&mut self) -> BuilderResult<Vec<BinaryTarget>>
Lists all available binaries in the project.
Sourcepub fn build(self) -> BuilderResult<BuildResult>
pub fn build(self) -> BuilderResult<BuildResult>
Executes the build with configured options.
Trait Implementations§
Source§impl Clone for RustBuilder
impl Clone for RustBuilder
Source§fn clone(&self) -> RustBuilder
fn clone(&self) -> RustBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more