pub trait CommandLineStep:
'static
+ Clone
+ Debug
+ PartialEq
+ Eq
+ Hash {
type Output: Clone;
const IS_HOST: bool = false;
// Required methods
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>;
fn make_run(_run: RunConfig<'_>);
fn run(self, builder: &Builder<'_>) -> Self::Output;
// Provided methods
fn is_default_step(_builder: &Builder<'_>) -> bool { ... }
fn metadata(&self) -> Option<StepMetadata> { ... }
}Expand description
A Step that can be selected by command-line arguments.
A blanket impl allows every CommandLineStep to be used as a Step.
This is arguably nicer than having it be a subtrait, because it avoids the
need for two separate impl blocks per command-line-step type.
Provided Associated Constants§
Sourceconst IS_HOST: bool = false
const IS_HOST: bool = false
If this value is true, then the values of run.target passed to the make_run function of
this Step will be determined based on the --host flag.
If this value is false, then they will be determined based on the --target flag.
A corollary of the above is that if this is set to true, then the step will be skipped if
--target was specified, but --host was explicitly set to ‘’ (empty string).
Required Associated Types§
Required Methods§
Sourcefn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
Called to allow steps to register the command-line paths that should cause them to run.
Sourcefn make_run(_run: RunConfig<'_>)
fn make_run(_run: RunConfig<'_>)
Called directly by the bootstrap Step handler when not triggered indirectly by other Steps using Builder::ensure.
For example, ./x.py test bootstrap runs this for test::Bootstrap. Similarly, ./x.py test runs it for every step
that is listed by the describe macro in Builder::get_step_descriptions.
Provided Methods§
Sourcefn is_default_step(_builder: &Builder<'_>) -> bool
fn is_default_step(_builder: &Builder<'_>) -> bool
Should this step run when the user invokes bootstrap with a subcommand but no paths/aliases?
For example, ./x test runs all default test steps, and ./x dist
runs all default dist steps.
Most steps are always default or always non-default, and just return true or false. But some steps are conditionally default, based on bootstrap config or the availability of ambient tools.
If the underlying check should not be performed repeatedly (e.g. because it probes command-line tools), consider memoizing its outcome via a field in the builder.
Sourcefn metadata(&self) -> Option<StepMetadata>
fn metadata(&self) -> Option<StepMetadata>
Used as the implementation of Step::metadata.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".