pub struct SysrootBuilder<'a> { /* private fields */ }
Expand description
Information about a to-be-created sysroot.
Implementations§
Source§impl<'a> SysrootBuilder<'a>
impl<'a> SysrootBuilder<'a>
Sourcepub fn new(sysroot_dir: &Path, target: impl Into<OsString>) -> Self
pub fn new(sysroot_dir: &Path, target: impl Into<OsString>) -> Self
Prepare to create a new sysroot in the given folder (that folder should later be passed to
rustc via --sysroot
), for the given target.
Sourcepub fn build_mode(self, build_mode: BuildMode) -> Self
pub fn build_mode(self, build_mode: BuildMode) -> Self
Sets the build mode (regular build vs check-only build).
Sourcepub fn sysroot_config(self, sysroot_config: SysrootConfig) -> Self
pub fn sysroot_config(self, sysroot_config: SysrootConfig) -> Self
Sets the sysroot configuration (which parts of the sysroot to build and with which features).
Sourcepub fn rustflags(
self,
rustflags: impl IntoIterator<Item = impl Into<OsString>>,
) -> Self
pub fn rustflags( self, rustflags: impl IntoIterator<Item = impl Into<OsString>>, ) -> Self
Appends the given flags.
Sourcepub fn cargo(self, cargo: Command) -> Self
pub fn cargo(self, cargo: Command) -> Self
Sets the cargo command to call.
This will be invoked with output()
, so if stdout/stderr should be inherited
then that needs to be set explicitly.
Sourcepub fn rustc_version(self, rustc_version: VersionMeta) -> Self
pub fn rustc_version(self, rustc_version: VersionMeta) -> Self
Sets the rustc version information (in case the user has that available).
Sourcepub fn when_build_required(
self,
when_build_required: impl FnOnce() + 'a,
) -> Self
pub fn when_build_required( self, when_build_required: impl FnOnce() + 'a, ) -> Self
Sets the hook that will be called if we don’t have a cached sysroot available and a new one will be compiled.
Sourcepub fn build_from_source(self, src_dir: &Path) -> Result<SysrootStatus>
pub fn build_from_source(self, src_dir: &Path) -> Result<SysrootStatus>
Build the self
sysroot from the given sources.
src_dir
must be the library
source folder, i.e., the one that contains std/Cargo.toml
.