pub struct Printer;
Expand description
Printer for the IR.
Implementations§
Source§impl 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<()>
pub fn write_externs<'a, F, I>( (path, prims): (&Path, I), f: &mut F, ) -> Result<()>
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>) -> String
pub fn assignment_to_str<T>(assign: &Assignment<T>) -> String
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>(guard: &Guard<T>) -> String
pub fn guard_str<T>(guard: &Guard<T>) -> String
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
pub fn write_source_info_table<W: Write>( f: &mut W, metadata: &Option<SourceInfoTable>, ) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for Printer
impl RefUnwindSafe for Printer
impl Send for Printer
impl Sync for Printer
impl Unpin for Printer
impl UnwindSafe for Printer
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
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>
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>
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