[][src]Trait c2rust_transpile::cfg::structures::StructuredStatement

pub trait StructuredStatement: Sized {
    type E;
    type P;
    type L;
    type S;
    fn empty() -> Self;
fn mk_singleton(stmt: Self::S) -> Self;
fn mk_append(self, second: Self) -> Self;
fn mk_goto(to: Self::L) -> Self;
fn mk_match(cond: Self::E, cases: Vec<(Vec<Self::P>, Self)>) -> Self;
fn mk_if(cond: Self::E, then: Self, else_: Self) -> Self;
fn mk_goto_table(cases: Vec<(Self::L, Self)>, then: Self) -> Self;
fn mk_loop(lbl: Option<Self::L>, body: Self) -> Self;
fn mk_exit(exit_style: ExitStyle, label: Option<Self::L>) -> Self; }

This is precisely what we need to construct structured statements

Associated Types

type E

An expression

type P

A pattern

type L

A label

type S

An unstructured regular statement

Loading content...

Required methods

fn empty() -> Self

An empty statement

fn mk_singleton(stmt: Self::S) -> Self

Project a single statement into a structured statement

fn mk_append(self, second: Self) -> Self

Execute one statement, then the other

fn mk_goto(to: Self::L) -> Self

Jump to a label

fn mk_match(cond: Self::E, cases: Vec<(Vec<Self::P>, Self)>) -> Self

Make a match statement

fn mk_if(cond: Self::E, then: Self, else_: Self) -> Self

Make an if statement

fn mk_goto_table(cases: Vec<(Self::L, Self)>, then: Self) -> Self

Make a goto table

fn mk_loop(lbl: Option<Self::L>, body: Self) -> Self

Make some sort of loop

fn mk_exit(exit_style: ExitStyle, label: Option<Self::L>) -> Self

Make an exit from a loop

Loading content...

Implementors

impl<E, P, L, S> StructuredStatement for StructuredAST<E, P, L, S>[src]

type E = E

type P = P

type L = L

type S = S

Loading content...