pub struct PrintFormatter<'a> {
pub env: &'a Environment,
pub seen_identifiers: HashSet<IdentifierId>,
pub seen_scopes: HashSet<ScopeId>,
pub output: Vec<String>,
pub indent_level: usize,
}Expand description
Shared formatter state used by both HIR and reactive printers.
Both DebugPrinter structs delegate to this for formatting shared constructs
like Places, Identifiers, Scopes, Types, InstructionValues, etc.
Fields§
§env: &'a Environment§seen_identifiers: HashSet<IdentifierId>§seen_scopes: HashSet<ScopeId>§output: Vec<String>§indent_level: usizeImplementations§
Source§impl<'a> PrintFormatter<'a>
impl<'a> PrintFormatter<'a>
pub fn new(env: &'a Environment) -> Self
pub fn line(&mut self, text: &str)
Sourcepub fn line_raw(&mut self, text: &str)
pub fn line_raw(&mut self, text: &str)
Write a line without adding indentation (used when copying pre-formatted output)
pub fn indent(&mut self)
pub fn dedent(&mut self)
pub fn to_string_output(&self) -> String
pub fn format_effect(&self, effect: &AliasingEffect) -> String
pub fn format_place_field(&mut self, field_name: &str, place: &Place)
pub fn format_identifier(&mut self, id: IdentifierId)
pub fn format_scope_field(&mut self, field_name: &str, scope_id: ScopeId)
pub fn format_type(&self, type_id: TypeId) -> String
pub fn format_type_value(&self, ty: &Type) -> String
pub fn format_lvalue(&mut self, field_name: &str, lv: &LValue)
pub fn format_pattern(&mut self, pattern: &Pattern)
pub fn format_argument(&mut self, arg: &PlaceOrSpread, index: usize)
Sourcepub fn format_instruction_value(
&mut self,
value: &InstructionValue,
inner_func_formatter: Option<&dyn Fn(&mut PrintFormatter<'_>, &HirFunction)>,
)
pub fn format_instruction_value( &mut self, value: &InstructionValue, inner_func_formatter: Option<&dyn Fn(&mut PrintFormatter<'_>, &HirFunction)>, )
Format an InstructionValue. The inner_func_formatter callback is invoked
for FunctionExpression/ObjectMethod to format the inner HirFunction. If None,
a placeholder is printed instead.
pub fn format_errors(&mut self, error: &CompilerError)
Auto Trait Implementations§
impl<'a> Freeze for PrintFormatter<'a>
impl<'a> RefUnwindSafe for PrintFormatter<'a>
impl<'a> Send for PrintFormatter<'a>
impl<'a> Sync for PrintFormatter<'a>
impl<'a> Unpin for PrintFormatter<'a>
impl<'a> UnsafeUnpin for PrintFormatter<'a>
impl<'a> UnwindSafe for PrintFormatter<'a>
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