pub struct RustBuild { /* private fields */ }Expand description
Represents a Rust build for a specific target triple.
Implementations§
Source§impl RustBuild
impl RustBuild
Sourcepub fn new(path: impl AsRef<Path>, triple: Triple) -> Self
pub fn new(path: impl AsRef<Path>, triple: Triple) -> Self
Create a new rust build for the given path and target triple.
Sourcepub fn with_target_dir(self, target_dir: impl Into<PathBuf>) -> Self
pub fn with_target_dir(self, target_dir: impl Into<PathBuf>) -> Self
Use an explicit Cargo target directory.
Sourcepub fn with_sccache(self, sccache_path: PathBuf) -> Self
pub fn with_sccache(self, sccache_path: PathBuf) -> Self
Set the sccache path for compilation caching.
When set, RUSTC_WRAPPER will be configured to use sccache,
which can significantly improve incremental build times.
Sourcepub fn with_feature(self, feature: impl Into<String>) -> Self
pub fn with_feature(self, feature: impl Into<String>) -> Self
Add a Cargo feature to enable during the build.
Features are passed to cargo via --features.
Sourcepub fn with_features(
self,
features: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_features( self, features: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Add multiple Cargo features to enable during the build.
Sourcepub fn with_rustc_flag(self, flag: impl Into<String>) -> Self
pub fn with_rustc_flag(self, flag: impl Into<String>) -> Self
Add a rustc flag to the build via RUSTFLAGS.
Sourcepub fn with_final_rustc_arg(self, flag: impl Into<String>) -> Self
pub fn with_final_rustc_arg(self, flag: impl Into<String>) -> Self
Add a rustc flag that applies to the final crate only.
The flag is passed as a trailing cargo rustc argument instead of through
RUSTFLAGS, so dependency unit fingerprints stay identical across builds that
differ only in how their final artifact links. See the field documentation on
final_rustc_args for why link arguments must take this route.
Sourcepub fn with_build_std(self, toolchain: impl Into<String>) -> Self
pub fn with_build_std(self, toolchain: impl Into<String>) -> Self
Build the Rust standard library from source with -Zbuild-std on the
named toolchain (a nightly with rust-src), sharing one libstd
dylib across the graph.
The build runs Cargo under the water rustc wrapper
(crate::rustc_wrapper): Cargo strips dylib from std’s crate
types under -Zbuild-std, and the wrapper restores it so the produced
libstd-*.so carries the same strict version hash as the rlib every
dependent is compiled against. The wrapper also publishes the dylib
into the profile’s deps/ directory, where
RustDynamicLibraries::resolve finds it before the toolchain’s
prebuilt copy.
Sourcepub fn with_preferred_dynamic_linking(self) -> Self
pub fn with_preferred_dynamic_linking(self) -> Self
Prefer dynamic Rust dependencies and emit loader search paths for them.
Sourcepub fn with_linkage(
self,
linkage: RustLinkage,
development_feature: &str,
loader_search_path: Option<&str>,
) -> Self
pub fn with_linkage( self, linkage: RustLinkage, development_feature: &str, loader_search_path: Option<&str>, ) -> Self
Configure this build for the selected Rust runtime linkage.
A shared-runtime development build enables the project’s dev feature (which
resolves the shared waterui-dylib runtime), prefers dynamic linking, and —
when the platform’s loader needs one — embeds a loader search path into the
final artifact only. A static packaging build needs none of this.
Sourcepub fn with_crate_type_override(self, crate_type: impl Into<String>) -> Self
pub fn with_crate_type_override(self, crate_type: impl Into<String>) -> Self
Override the library crate type passed to rustc.
Sourcepub fn with_env(
self,
key: impl Into<String>,
value: impl Into<OsString>,
) -> Self
pub fn with_env( self, key: impl Into<String>, value: impl Into<OsString>, ) -> Self
Add an environment variable for the cargo build process.
Sourcepub fn with_envs(
self,
envs: impl IntoIterator<Item = (String, OsString)>,
) -> Self
pub fn with_envs( self, envs: impl IntoIterator<Item = (String, OsString)>, ) -> Self
Add multiple environment variables for the cargo build process.
Sourcepub fn with_progress(self, progress: BuildProgress) -> Self
pub fn with_progress(self, progress: BuildProgress) -> Self
Attach a compile-progress sink the cargo invocation reports to.
Each CompileEvent is parsed from cargo’s own stderr stream, so the
report is driven by build output rather than a timer.
Sourcepub async fn dev_build(&self) -> Result<BuiltTarget, RustBuildError>
pub async fn dev_build(&self) -> Result<BuiltTarget, RustBuildError>
Build rust library in development mode.
Will produce debug symbols and less optimizations for faster builds.
§Errors
RustBuildError::FailToExecuteCargoBuild: If there was an error executing the cargo build command.RustBuildError::FailToBuildRustLibrary: If there was an error building the Rust library.
Sourcepub async fn release_build(&self) -> Result<BuiltTarget, RustBuildError>
pub async fn release_build(&self) -> Result<BuiltTarget, RustBuildError>
Build rust library in release mode.
§Errors
RustBuildError::FailToExecuteCargoBuild: If there was an error executing the cargo build command.RustBuildError::FailToBuildRustLibrary: If there was an error building the Rust library.
Sourcepub async fn build_lib(
&self,
release: bool,
) -> Result<BuiltTarget, RustBuildError>
pub async fn build_lib( &self, release: bool, ) -> Result<BuiltTarget, RustBuildError>
Build the crate’s library target.
The returned BuiltTarget carries the profile directory plus the
artifact Cargo reported. A crate emitting several library crate types
needs Self::with_crate_type_override to say which one is wanted —
the build fails rather than guess.
§Errors
RustBuildError::FailToExecuteCargoBuild: If there was an error executing the cargo build command.RustBuildError::FailToBuildRustLibrary: If there was an error building the Rust library.
Sourcepub async fn build_dylib(
&self,
release: bool,
) -> Result<PathBuf, RustBuildError>
pub async fn build_dylib( &self, release: bool, ) -> Result<PathBuf, RustBuildError>
Build a dynamic library (cdylib) and return the full path to the dylib file.
The path is Cargo’s own compiler-artifact report, so the returned file
is the one this build wrote even when another project’s identically
named crate shares the target directory.
§Errors
RustBuildError::FailToExecuteCargoBuild: If there was an error executing the cargo build command.RustBuildError::FailToBuildRustLibrary: If the library was not found after building.
Sourcepub async fn build_binary(
&self,
binary_name: &str,
release: bool,
) -> Result<PathBuf, RustBuildError>
pub async fn build_binary( &self, binary_name: &str, release: bool, ) -> Result<PathBuf, RustBuildError>
Builds one named binary and returns its full output path.
The path is Cargo’s own compiler-artifact report (executable of the
--bin unit), so it is the binary this build wrote even when another
project’s identically named crate shares the target directory.
§Errors
Returns an error when Cargo fails or the expected binary is missing.
Sourcepub async fn dylib_path(
&self,
crate_name: &str,
release: bool,
) -> Result<PathBuf, RustBuildError>
pub async fn dylib_path( &self, crate_name: &str, release: bool, ) -> Result<PathBuf, RustBuildError>
Compute the expected dylib output path without building.
This uses cargo metadata to resolve the target directory to avoid assuming
a fixed target/ path.
§Errors
Returns an error if Cargo metadata cannot be read.
Sourcepub async fn lib_output_dir(
&self,
release: bool,
) -> Result<PathBuf, RustBuildError>
pub async fn lib_output_dir( &self, release: bool, ) -> Result<PathBuf, RustBuildError>
Resolve the Cargo library artifact directory for this build target and profile.
§Errors
Returns an error if Cargo metadata cannot be read for this build target.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RustBuild
impl !UnwindSafe for RustBuild
impl Freeze for RustBuild
impl Send for RustBuild
impl Sync for RustBuild
impl Unpin for RustBuild
impl UnsafeUnpin for RustBuild
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.