pub struct FlatGraphBuilder { /* private fields */ }
Expand description
Wraper around DfirGraph
to build a flat graph from AST code.
Implementations§
Source§impl FlatGraphBuilder
impl FlatGraphBuilder
Sourcepub fn build(self) -> (DfirGraph, Vec<ItemUse>, Vec<Diagnostic>)
pub fn build(self) -> (DfirGraph, Vec<ItemUse>, Vec<Diagnostic>)
Build into an unpartitioned DfirGraph
, returning a tuple of the graph and
any diagnostics.
Even if there are errors, the graph will be returned (potentially in a invalid
state). Does not call emit
on any diagnostics.
Sourcepub fn add_dfir(
&mut self,
dfir: DfirCode,
current_loop: Option<GraphLoopId>,
operator_tag: Option<&str>,
)
pub fn add_dfir( &mut self, dfir: DfirCode, current_loop: Option<GraphLoopId>, operator_tag: Option<&str>, )
Adds all DfirStatement
s within the DfirCode
to this DfirGraph
.
Optional configuration:
- In the given loop context
current_loop
. - With the given operator tag
operator_tag
.
Sourcepub fn add_statement(&mut self, stmt: DfirStatement)
pub fn add_statement(&mut self, stmt: DfirStatement)
Add a single DfirStatement
line to this DfirGraph
in the root context.
Sourcepub fn append_assign_pipeline(
&mut self,
asgn_name: Option<&Ident>,
pred_name: Option<&Ident>,
pipeline: Pipeline,
current_loop: Option<GraphLoopId>,
operator_tag: Option<&str>,
)
pub fn append_assign_pipeline( &mut self, asgn_name: Option<&Ident>, pred_name: Option<&Ident>, pipeline: Pipeline, current_loop: Option<GraphLoopId>, operator_tag: Option<&str>, )
Programatically add an pipeline, optionally adding pred_name
as a single predecessor and
assigning it all to asgn_name
.
In DFIR syntax, equivalent to Self::add_statement
of (if all names are supplied):
#asgn_name = #pred_name -> #pipeline;
But with, optionally:
- A
current_loop
to put the operator in. - An
operator_tag
to tag the operator with, for debugging/tracing.
Trait Implementations§
Source§impl Debug for FlatGraphBuilder
impl Debug for FlatGraphBuilder
Source§impl Default for FlatGraphBuilder
impl Default for FlatGraphBuilder
Source§fn default() -> FlatGraphBuilder
fn default() -> FlatGraphBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FlatGraphBuilder
impl !RefUnwindSafe for FlatGraphBuilder
impl !Send for FlatGraphBuilder
impl !Sync for FlatGraphBuilder
impl Unpin for FlatGraphBuilder
impl !UnwindSafe for FlatGraphBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more