Step in bootstrap::core::builder - Rust (original) (raw)

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> { ... }
}

Source

Source

If true, then this rule should be skipped if –target was specified, but –host was not

Source

Result type of Step::run.

Source

Primary function to implement Step logic.

This function can be triggered in two ways:

  1. Directly from Builder::execute_cli.
  2. Indirectly by being called from other Steps using Builder::ensure.

When called with Builder::execute_cli (as done by Build::build), this function is executed twice:

When triggered indirectly from other Steps, it may still run twice (as dry-run and real mode) depending on the Step::run implementation of the caller.

Source

Determines if this Step should be run when given specific paths (e.g., x build $path).

Source

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.

Source

Returns metadata of the step, for tests

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.