Skip to main content

Tracer

Struct Tracer 

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

Tracer for collecting debugging information during type checking.

Implementations§

Source§

impl Tracer

Source

pub fn new(level: TraceLevel) -> Self

Create a new tracer with the given level.

Source

pub fn silent() -> Self

Create a silent tracer.

Source

pub fn verbose() -> Self

Create a fully verbose tracer.

Source

pub fn set_level(&mut self, level: TraceLevel)

Set the trace level.

Source

pub fn level(&self) -> TraceLevel

Get the trace level.

Source

pub fn set_max_events(&mut self, max: usize)

Set the max events buffer size.

Source

pub fn set_timing(&mut self, enabled: bool)

Enable or disable timing.

Source

pub fn suppress(&mut self, cat: TraceCategory)

Suppress a category.

Source

pub fn allow(&mut self, cat: &TraceCategory)

Allow a category.

Source

pub fn log(&mut self, event: TraceEvent)

Log a trace event.

Source

pub fn log_msg(&mut self, level: TraceLevel, msg: impl Into<String>)

Log a string at the given level.

Source

pub fn error(&mut self, msg: impl Into<String>)

Log an error.

Source

pub fn warn(&mut self, msg: impl Into<String>)

Log a warning.

Source

pub fn info(&mut self, msg: impl Into<String>)

Log an info message.

Source

pub fn debug(&mut self, msg: impl Into<String>)

Log a debug message.

Source

pub fn trace_msg(&mut self, msg: impl Into<String>)

Log a trace message.

Source

pub fn trace_infer(&mut self, msg: impl Into<String>)

Log a trace-level message in the Infer category.

Source

pub fn trace_reduce(&mut self, msg: impl Into<String>)

Log a trace-level message in the Reduce category.

Source

pub fn record_reduction( &mut self, rule: ReductionRule, before: Expr, after: Expr, )

Record a reduction step.

Source

pub fn reduction_steps(&self) -> &[ReductionStep]

Get reduction steps.

Source

pub fn clear_reductions(&mut self)

Clear reduction steps.

Source

pub fn events(&self) -> &[TraceEvent]

Get all logged events.

Source

pub fn events_at_level(&self, level: TraceLevel) -> Vec<&TraceEvent>

Get events at a specific level.

Source

pub fn events_in_category(&self, cat: &TraceCategory) -> Vec<&TraceEvent>

Get events in a specific category.

Source

pub fn clear(&mut self)

Clear all events.

Source

pub fn event_count(&self) -> usize

Count events.

Source

pub fn push(&mut self)

Push depth.

Source

pub fn pop(&mut self)

Pop depth.

Source

pub fn current_depth(&self) -> u32

Get current depth.

Source

pub fn elapsed(&self) -> Option<Duration>

Get elapsed time since tracing started.

Source

pub fn render(&self) -> String

Render all events as a multi-line string.

Source§

impl Tracer

Extension trait for Tracer providing convenience methods.

Source

pub fn debug_return<T>(&mut self, value: T, msg: impl Into<String>) -> T

Log and return a message at Debug level.

Source

pub fn debug_expr(&mut self, label: &str, expr: &Expr)

Log an expression at Debug level.

Source

pub fn stats(&self) -> TracerStats

Compute statistics for this tracer.

Source

pub fn last_event(&self) -> Option<&TraceEvent>

Return the most recent event, if any.

Source

pub fn last_error(&self) -> Option<&TraceEvent>

Return the most recent error event, if any.

Source

pub fn is_empty(&self) -> bool

Check whether the tracer has any events.

Source

pub fn log_with_category( &mut self, level: TraceLevel, category: TraceCategory, msg: impl Into<String>, )

Log with a specific category.

Source

pub fn log_infer(&mut self, msg: impl Into<String>)

Log an infer event at Debug level.

Source

pub fn log_simp(&mut self, msg: impl Into<String>)

Log a simp event at Trace level.

Source

pub fn log_tactic(&mut self, msg: impl Into<String>)

Log a tactic event at Info level.

Source

pub fn log_elab(&mut self, msg: impl Into<String>)

Log an elaboration event at Debug level.

Source

pub fn category_log(&self, cat: &TraceCategory) -> Vec<String>

Return all events in a given category as formatted strings.

Source

pub fn clear_category(&mut self, cat: &TraceCategory)

Clear only events in a given category.

Trait Implementations§

Source§

impl Default for Tracer

Source§

fn default() -> Self

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