pub struct BuildStd { /* private fields */ }os_cmd only.Expand description
Represents the build options for the standard library components.
By default (BuildStd::default()), all options are set to false.
Note: BuildStd.build_default is NOT equivalent to
BuildStd::default()
-
Special Option:
build_default: When set totrue=>["-Z", "build-std"], which compilescore,std,alloc, andproc_macro.- Note: Other options will override
build_default- When
build_defaultis true andcoreis also true, =>["-Z", "build-std=core"] - Only when
build_defaultis true and all other options are false, =>["-Z", "build-std"]
- When
- Note: Other options will override
-
core:true=>["-Z", "build-std=core"] -
alloc:true=>["-Z", "build-std=alloc"] -
When both
coreandallocaretrue=>["-Z", "build-std=core,alloc"]
You can control the components to be compiled using the with_ methods.
§Example
use testutils::os_cmd::presets::cargo_build::{ArgConverter, BuildStd};
let build_std_with_core_and_alloc = BuildStd::default()
.with_std(false)
.with_core(true)
.with_alloc(true)
.with_build_default(true);
assert_eq!(
build_std_with_core_and_alloc
.to_args()
.next(),
Some("-Z".into())
);
assert_eq!(
build_std_with_core_and_alloc
.to_args()
.last(),
Some("build-std=core,alloc".into())
);
let build_std_with_default_only = BuildStd::default().with_build_default(true);
assert_eq!(
build_std_with_default_only
.to_args()
.last(),
Some("build-std".into())
);
let build_std_none_enabled = BuildStd::default();
assert_eq!(
build_std_none_enabled
.to_args()
.next(),
None
);Implementations§
Source§impl BuildStd
impl BuildStd
pub fn with_build_default(self, val: bool) -> Self
pub fn with_std(self, val: bool) -> Self
pub fn with_core(self, val: bool) -> Self
pub fn with_alloc(self, val: bool) -> Self
pub fn with_panic_abort(self, val: bool) -> Self
pub fn with_panic_unwind(self, val: bool) -> Self
pub fn with_test(self, val: bool) -> Self
pub fn with_proc_macro(self, val: bool) -> Self
Source§impl BuildStd
impl BuildStd
pub fn get_build_default(&self) -> bool
pub fn get_std(&self) -> bool
pub fn get_core(&self) -> bool
pub fn get_alloc(&self) -> bool
pub fn get_panic_abort(&self) -> bool
pub fn get_panic_unwind(&self) -> bool
pub fn get_test(&self) -> bool
pub fn get_proc_macro(&self) -> bool
Trait Implementations§
Source§impl ArgConverter for BuildStd
impl ArgConverter for BuildStd
Source§fn to_args(&self) -> Self::ArgsIter
fn to_args(&self) -> Self::ArgsIter
Converts the BuildStd struct to an array of arguments.
This method generates a list of arguments based on the enabled fields
in the BuildStd struct. If no fields are enabled, it returns None.
If build_default is enabled, it returns the default build arguments.
type ArgsIter = Flatten<IntoIter<[CompactString; 2]>>
Auto Trait Implementations§
impl Freeze for BuildStd
impl RefUnwindSafe for BuildStd
impl Send for BuildStd
impl Sync for BuildStd
impl Unpin for BuildStd
impl UnsafeUnpin for BuildStd
impl UnwindSafe for BuildStd
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.