Skip to main content

PassManager

Struct PassManager 

Source
pub struct PassManager {
    pub registry: PassRegistry,
    /* private fields */
}
Expand description

Runs the pipelines a program states and verifies the world between steps.

Fields§

§registry: PassRegistry

Implementations§

Source§

impl PassManager

Source

pub fn new(registry: PassRegistry) -> Self

Source

pub fn with_settings(self, settings: Settings) -> Self

State the program’s run settings: before every pipeline it runs, plain or a conversion’s part, the manager states them in the world, and a pass that declares a setting (Pass::settings) reads it there. A manager that states none runs only passes that read none (another is refused, Error::Missing); a world that already states a setting otherwise is refused (Error::SettingDisagrees).

Source

pub fn with_pass_checks(self, on: bool) -> Self

The pass checks, after every pass: its effects entity by entity against its declarations (what it adds to or takes from an entity, what it despawns, the resources it writes: Pass::provides, Pass::removes, Pass::modifies), then the verifier (Component::verify, crate::Resource::verify, the validators) on what it leaves. On in debug builds (the test suites); off by default in release builds, for speed, so a pass that leaves an invalid component is not named there unless the program opts in with true. Measured on a level of 16,000 placements (12 passes, release): the verifier 0.26 s and the declaration diff another 0.46 s, against 1.6 s of passes. What a pass’s names do across the whole world is checked either way, and a conversion (PassManager::convert) verifies the reader’s output and the world before its writer either way. The in-place edits of values on entities that keep the name are not in the declaration diff in any build (Pass::modifies); only the verifier sees their result, and only after the pass when the checks are on.

Source

pub fn pass_checks(&self) -> bool

Source

pub fn with_missing_inputs(self, policy: MissingInputs) -> Self

State how to handle unfed preparation steps. Skipping never supplies default data or calls an unfed pass: its StepReport::skipped lists the absent names, and later steps inspect the world actually left by earlier steps. The default remains strict refusal.

Source

pub fn with_conservation(self, c: Conservation) -> Self

Run the conservation diagnostics around every pass (crate::ledger): off by default.

Source

pub fn conservation(&self) -> Conservation

Source

pub fn add_validator(&mut self, v: Box<dyn Validator>)

Source

pub fn verify(&self, w: &World, after: &str) -> Result<()>

Every component’s own checks and every world validator. after names the step for the error.

Source

pub fn run( &self, w: &mut World, pipeline: &Pipeline, report: &mut RunReport, ) -> Result<()>

Run a pipeline as written, verifying after every pass and checking each pass’s declarations.

Source

pub fn run_instrumented( &self, w: &mut World, pipeline: &Pipeline, report: &mut RunReport, instrument: &mut dyn Instrument, ) -> Result<()>

PassManager::run, calling instrument around every pass.

Source

pub fn run_part( &self, w: &mut World, pipeline: &Pipeline, report: &mut RunReport, ) -> Result<()>

PassManager::run on one part of a conversion (crate::convert), with the same rule as any run: a pass that opts in (Pass::may_lack_inputs), requires names and finds none of them has nothing to do there and is skipped, recorded (its step’s StepReport::skipped, a SKIPPED count in its log). Any other pass whose required names are absent fails, as does an opted-in pass that finds some of them but not all; a pass that requires nothing always runs. An explicit MissingInputs::Skip policy also skips other unfed steps, retaining their missing names in the report.

Source

pub fn convert( &self, w: &mut World, pipeline: &Pipeline, target: &Target, mode: Mode, ) -> Result<RunReport>

Run the stated pipeline and check the world it leaves against target: verify the reader’s world, run the pipeline as written (verifying after every pass with the pass checks), then check that the target accepts every component and resource in mode, and verify once more before the writer. A name the target still refuses is Error::Illegal, naming the passes of the pipeline that remove or rewrite it, or none: the manager never adds a pass to lower it.

Source

pub fn convert_instrumented( &self, w: &mut World, pipeline: &Pipeline, target: &Target, mode: Mode, instrument: &mut dyn Instrument, ) -> Result<RunReport>

PassManager::convert, calling instrument around every pass of the pipeline.

Trait Implementations§

Source§

impl Debug for PassManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PassManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.