pub struct Printer;
Expand description
Printer for the IR.
Implementations
sourceimpl Printer
impl Printer
sourcepub fn format_at_attributes(attrs: &Attributes) -> String
pub fn format_at_attributes(attrs: &Attributes) -> String
Format attributes of the form @static(1)
.
Returns the empty string if the attrs
is empty.
sourcepub fn format_attributes(attrs: &Attributes) -> String
pub fn format_attributes(attrs: &Attributes) -> String
Format attributes of the form <"static"=1>
.
Returns the empty string if the attrs
is empty.
sourcepub fn format_ports(ports: &[RRC<Port>]) -> String
pub fn format_ports(ports: &[RRC<Port>]) -> String
Formats port definitions in signatures
pub fn format_port_def<W: Display>(port_defs: &[&PortDef<W>]) -> String
sourcepub fn write_context<F: Write>(
ctx: &Context,
skip_primitives: bool,
f: &mut F
) -> Result<()>
pub fn write_context<F: Write>(
ctx: &Context,
skip_primitives: bool,
f: &mut F
) -> Result<()>
Prints out the program context.
If skip_primitives
is true, the printer will skip printing primitives defined outside the source file.
sourcepub fn write_externs<'a, F, I>(
(path, prims): (&Path, I),
f: &mut F
) -> Result<()>where
F: Write,
I: Iterator<Item = &'a Primitive>,
pub fn write_externs<'a, F, I>(
(path, prims): (&Path, I),
f: &mut F
) -> Result<()>where
F: Write,
I: Iterator<Item = &'a Primitive>,
Formats and writes extern statements.
pub fn write_primitive<F: Write>(
prim: &Primitive,
indent: usize,
f: &mut F
) -> Result<()>
sourcepub fn write_component<F: Write>(comp: &Component, f: &mut F) -> Result<()>
pub fn write_component<F: Write>(comp: &Component, f: &mut F) -> Result<()>
Formats and writes the Component to the formatter.
pub fn write_float_const<F: Write>(
cell: &Cell,
indent_level: usize,
f: &mut F
) -> Result<()>
sourcepub fn write_cell<F: Write>(
cell: &Cell,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_cell<F: Write>(
cell: &Cell,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a cell.
sourcepub fn write_assignment<F: Write, T: Clone + ToString + Eq>(
assign: &Assignment<T>,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_assignment<F: Write, T: Clone + ToString + Eq>(
assign: &Assignment<T>,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write an assignment.
sourcepub fn assignment_to_str<T>(assign: &Assignment<T>) -> Stringwhere
T: ToString + Clone + Eq,
pub fn assignment_to_str<T>(assign: &Assignment<T>) -> Stringwhere
T: ToString + Clone + Eq,
Convinience method to get string representation of ir::Assignment.
sourcepub fn control_to_str(assign: &Control) -> String
pub fn control_to_str(assign: &Control) -> String
Convinience method to get string representation of ir::Control.
sourcepub fn write_comb_group<F: Write>(
group: &CombGroup,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_comb_group<F: Write>(
group: &CombGroup,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a combinational group.
sourcepub fn write_group<F: Write>(
group: &Group,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_group<F: Write>(
group: &Group,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a group.
sourcepub fn write_static_group<F: Write>(
group: &StaticGroup,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_static_group<F: Write>(
group: &StaticGroup,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a static group.
sourcepub fn write_static_control<F: Write>(
scontrol: &StaticControl,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_static_control<F: Write>(
scontrol: &StaticControl,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a static control program
sourcepub fn write_control<F: Write>(
control: &Control,
indent_level: usize,
f: &mut F
) -> Result<()>
pub fn write_control<F: Write>(
control: &Control,
indent_level: usize,
f: &mut F
) -> Result<()>
Format and write a control program
sourcepub fn guard_str<T: ToString>(guard: &Guard<T>) -> Stringwhere
T: Eq,
pub fn guard_str<T: ToString>(guard: &Guard<T>) -> Stringwhere
T: Eq,
Generate a String-based representation for a guard.
sourcepub fn port_to_str(port: &Port) -> String
pub fn port_to_str(port: &Port) -> String
Get the port access expression.
sourcepub fn format_metadata(metadata: &Option<String>) -> String
pub fn format_metadata(metadata: &Option<String>) -> String
Formats the top-level metadata if present