Skip to main content

GuestBuild

Struct GuestBuild 

Source
pub struct GuestBuild {
    pub manifest_dir: PathBuf,
    pub target_json_path: PathBuf,
    pub target_dir_name: String,
    pub build_kind: BuildKind,
    pub extra_rustflags: Vec<String>,
    pub env_overrides: Vec<(String, String)>,
    pub rustc_bootstrap: bool,
}
Expand description

Configuration for a guest (cross-compiled) cargo build.

Spawns a separate cargo build subprocess with its own CARGO_TARGET_DIR to avoid deadlocking with the outer cargo process running build.rs.

Fields§

§manifest_dir: PathBuf

Absolute path to the service crate directory (containing Cargo.toml).

§target_json_path: PathBuf

Absolute path to the target JSON file.

§target_dir_name: String

Name used as subdirectory in cargo’s target dir (e.g. “riscv64em-javm”). This is the directory name cargo creates under target/ for the custom target.

§build_kind: BuildKind

Whether to build a binary or library.

§extra_rustflags: Vec<String>

Extra flags appended to CARGO_ENCODED_RUSTFLAGS.

§env_overrides: Vec<(String, String)>

Extra environment variables to set (e.g. CARGO_PROFILE_RELEASE_STRIP=false).

§rustc_bootstrap: bool

Set RUSTC_BOOTSTRAP=1 so stable rustc accepts -Z flags.

Implementations§

Source§

impl GuestBuild

Source

pub fn build(&self) -> PathBuf

Run the inner cargo build. Returns the absolute path to the output ELF.

Emits cargo:rerun-if-changed directives for the service source files and cargo:rerun-if-env-changed for SKIP_GUEST_BUILD.

§Panics

Panics if the build fails or the output artifact is not found.

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.