pub struct Schedule<C> { /* private fields */ }Expand description
An ordered sequence of passes, indexed by round.
Round r of an Engine run applies the pass at index r
of the schedule to every node that is ready for it, so a schedule doubles
as the fixed pass order of a run. Nodes created (or failed) in round r
are processed by round r + 1, which uses the next pass in the schedule.
§Examples
use increparse::{Outcome, Pass, Schedule, Span};
struct WholeFile;
struct Statements;
struct NoopCtx;
impl Pass for WholeFile {
type Ctx = ();
fn parse(&self, _source: &str, _span: Span, _ctx: &()) -> Outcome<()> {
Outcome::Done
}
}
impl Pass for Statements {
type Ctx = ();
fn parse(&self, _source: &str, _span: Span, _ctx: &()) -> Outcome<()> {
Outcome::Done
}
}
let mut schedule = Schedule::new();
schedule.push(WholeFile);
schedule.push(Statements);
assert_eq!(schedule.len(), 2);Implementations§
Source§impl<C> Schedule<C>
impl<C> Schedule<C>
Sourcepub fn push<P>(&mut self, pass: P)
pub fn push<P>(&mut self, pass: P)
Appends pass to the schedule; its round index is the previous length.
Sourcepub fn push_boxed(&mut self, pass: Box<dyn Pass<Ctx = C> + Send + Sync>)
pub fn push_boxed(&mut self, pass: Box<dyn Pass<Ctx = C> + Send + Sync>)
Appends an already-boxed pass.
Trait Implementations§
Auto Trait Implementations§
impl<C> !RefUnwindSafe for Schedule<C>
impl<C> !UnwindSafe for Schedule<C>
impl<C> Freeze for Schedule<C>
impl<C> Send for Schedule<C>
impl<C> Sync for Schedule<C>
impl<C> Unpin for Schedule<C>
impl<C> UnsafeUnpin for Schedule<C>
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
Mutably borrows from an owned value. Read more