Struct FlatGraphBuilder

Source
pub struct FlatGraphBuilder { /* private fields */ }
Expand description

Wraper around DfirGraph to build a flat graph from AST code.

Implementations§

Source§

impl FlatGraphBuilder

Source

pub fn new() -> Self

Create a new empty graph builder.

Source

pub fn from_dfir(input: DfirCode) -> Self

Convert the DFIR code AST into a graph builder.

Source

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.

Source

pub fn add_dfir( &mut self, dfir: DfirCode, current_loop: Option<GraphLoopId>, operator_tag: Option<&str>, )

Adds all DfirStatements within the DfirCode to this DfirGraph.

Optional configuration:

  • In the given loop context current_loop.
  • With the given operator tag operator_tag.
Source

pub fn add_statement(&mut self, stmt: DfirStatement)

Add a single DfirStatement line to this DfirGraph in the root context.

Source

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

Source§

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

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

impl Default for FlatGraphBuilder

Source§

fn default() -> FlatGraphBuilder

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<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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T