pub trait Step:
'static
+ Clone
+ Debug
+ PartialEq
+ Eq
+ Hash {
type Output: Clone;
const DEFAULT: bool = false;
const ONLY_HOSTS: bool = false;
// Required methods
fn run(self, builder: &Builder<'_>) -> Self::Output;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>;
// Provided methods
fn make_run(_run: RunConfig<'_>) { ... }
fn metadata(&self) -> Option<StepMetadata> { ... }
}
Provided Associated Constants§
Sourceconst DEFAULT: bool = false
const DEFAULT: bool = false
Whether this step is run by default as part of its respective phase, as defined by the describe
macro in Builder::get_step_descriptions
.
Note: Even if set to true
, it can still be overridden with ShouldRun::default_condition
by Step::should_run
.
Sourceconst ONLY_HOSTS: bool = false
const ONLY_HOSTS: bool = false
If true, then this rule should be skipped if –target was specified, but –host was not
Required Associated Types§
Required Methods§
Sourcefn run(self, builder: &Builder<'_>) -> Self::Output
fn run(self, builder: &Builder<'_>) -> Self::Output
Primary function to implement Step
logic.
This function can be triggered in two ways:
- Directly from
Builder::execute_cli
. - Indirectly by being called from other
Step
s usingBuilder::ensure
.
When called with Builder::execute_cli
(as done by Build::build
), this function is executed twice:
- First in “dry-run” mode to validate certain things (like cyclic Step invocations, directory creation, etc) super quickly.
- Then it’s called again to run the actual, very expensive process.
When triggered indirectly from other Step
s, it may still run twice (as dry-run and real mode)
depending on the Step::run
implementation of the caller.
Sourcefn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_>
Determines if this Step
should be run when given specific paths (e.g., x build $path
).
Provided Methods§
Sourcefn make_run(_run: RunConfig<'_>)
fn make_run(_run: RunConfig<'_>)
Called directly by the bootstrap Step
handler when not triggered indirectly by other Step
s 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
.
Sourcefn metadata(&self) -> Option<StepMetadata>
fn metadata(&self) -> Option<StepMetadata>
Returns metadata of the step, for tests
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.