pub trait Formatter {
// Required methods
fn start(
&mut self,
buffer: &mut String,
top_comments: &IndexMap<FlexStr, FlexStr>,
tables: &[&FlexStr],
);
fn end(&mut self, buffer: &mut String);
fn start_table(
&mut self,
buffer: &mut String,
name: &FlexStr,
comment: Option<&FlexStr>,
columns: &[ColumnInfo],
);
fn end_table(&mut self, buffer: &mut String);
fn start_row(
&mut self,
buffer: &mut String,
name: &FlexStr,
max_width: usize,
);
fn end_row(&mut self, buffer: &mut String);
fn used_column(
&mut self,
buffer: &mut String,
time: TimeUnit,
compare: Comparison,
max_width: usize,
);
fn unused_column(&mut self, buffer: &mut String, max_width: usize);
}Expand description
Implement this “visitor” trait to create a Formatter for a new file type
Required Methods§
Sourcefn start(
&mut self,
buffer: &mut String,
top_comments: &IndexMap<FlexStr, FlexStr>,
tables: &[&FlexStr],
)
fn start( &mut self, buffer: &mut String, top_comments: &IndexMap<FlexStr, FlexStr>, tables: &[&FlexStr], )
Called first at the start of output. Passed top level top_comments and a slice of table
names (typically used to build a table of contents)
Sourcefn start_table(
&mut self,
buffer: &mut String,
name: &FlexStr,
comment: Option<&FlexStr>,
columns: &[ColumnInfo],
)
fn start_table( &mut self, buffer: &mut String, name: &FlexStr, comment: Option<&FlexStr>, columns: &[ColumnInfo], )
Called before each table is output with the name of the table, a table comment, if any,
and column maximum display width data
Sourcefn start_row(&mut self, buffer: &mut String, name: &FlexStr, max_width: usize)
fn start_row(&mut self, buffer: &mut String, name: &FlexStr, max_width: usize)
Called at the start of each new row with the row name and the max_width of the row name
column
Sourcefn used_column(
&mut self,
buffer: &mut String,
time: TimeUnit,
compare: Comparison,
max_width: usize,
)
fn used_column( &mut self, buffer: &mut String, time: TimeUnit, compare: Comparison, max_width: usize, )
Called for each column that is populated with the time measurement, a comparison to baseline,
and the maximum display width of the column
Sourcefn unused_column(&mut self, buffer: &mut String, max_width: usize)
fn unused_column(&mut self, buffer: &mut String, max_width: usize)
Called for each column that is blank with the maximum display width of the the column
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".