#[non_exhaustive]pub struct DisplayOptions {
pub format: DisplayFormat,
pub columns: Vec<Column>,
pub wrap: bool,
pub sections: Vec<Section>,
pub metrics: Vec<&'static str>,
pub section_line_limit: usize,
}Expand description
Aggregate display options for the renderer. Plumbed as a
single struct through write_diff so a future addition
lands in one place without growing every signature. The
show-side entry (write_show in src/bin/ktstr.rs) keeps
a flatter signature for historical reasons but mirrors the
same field semantics — --wrap, --sections, --metrics
reach show via wrap / sections / metrics parameters
that share the same
helpers (new_wrapped_table, Section::cli_name).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.format: DisplayFormatFormat shorthand. Default DisplayFormat::Full.
columns: Vec<Column>User-supplied column override; empty Vec means “use the
format’s default column set.” Set via parse_columns.
wrap: boolWhen true, tables render with comfy-table’s
[comfy_table::ContentArrangement::Dynamic] layout
(terminal-width-aware cell wrapping). When false,
tables render with ContentArrangement::Disabled — the
prior shape, where columns can spill past the terminal
edge. Default false keeps existing operator workflows
untouched until the flag is opted into.
sections: Vec<Section>User-supplied section filter; empty Vec means “render
every section that has data” — the unfiltered default.
Non-empty restricts the rendered output to the listed
sections only. Set via parse_sections.
metrics: Vec<&'static str>User-supplied per-metric row filter; empty Vec means
“render every metric in the primary + derived sections”
— the unfiltered default. Non-empty restricts the
rendered rows to the listed metric names (which must
be in CTPROF_METRICS or
CTPROF_DERIVED_METRICS). Set via
parse_metrics.
Distinct from Self::sections: sections gate whole
sub-tables (primary, derived, cgroup-stats, …);
metrics gate individual ROWS within the primary and
derived sub-tables. The two compose — naming
--sections primary and --metrics run_time_ns shows
a single primary row.
section_line_limit: usizeMaximum rendered lines per section. Sections whose table
output exceeds this limit are truncated with a notice.
0 means unlimited (no truncation). Populated from the
CLI --limit arg (default 500); the struct’s Default
is 0 (unlimited).
Implementations§
Source§impl DisplayOptions
impl DisplayOptions
Sourcepub fn resolved_compare_columns(&self) -> Vec<Column>
pub fn resolved_compare_columns(&self) -> Vec<Column>
Resolved compare-side column set: columns if
non-empty, otherwise compare_columns_for over
format. --columns always wins over the format
shorthand (explicit > shorthand) per the design call.
Sourcepub fn resolved_show_columns(&self) -> Vec<Column>
pub fn resolved_show_columns(&self) -> Vec<Column>
Resolved show-side column set: columns if non-empty,
otherwise show_columns_default.
Sourcepub fn is_section_enabled(&self, section: Section) -> bool
pub fn is_section_enabled(&self, section: Section) -> bool
Returns true when section should render under the
current filter. Empty sections means “every section
renders” (the default — no filter applied), matching
parse_sections’s empty-input semantic. Non-empty
sections restricts rendering to the named entries.
Sourcepub fn is_metric_enabled(&self, name: &str) -> bool
pub fn is_metric_enabled(&self, name: &str) -> bool
Returns true when the metric named name should
render under the current row-level filter. Empty
metrics means “every metric renders” — the
unfiltered default mirroring
Self::is_section_enabled. Non-empty restricts
rendering to the listed names. The comparison is on
the metric’s &'static str name (so a registry-name
pointer or any byte-equal string both match).
Sourcepub fn new_table(&self) -> Table
pub fn new_table(&self) -> Table
Construct a comfy-table builder honouring the
wrap flag: terminal-width-aware
Dynamic arrangement when wrap is true, otherwise the
existing borderless, disabled-arrangement layout via
crate::cli::new_table. Single source of truth so
every section in write_diff honours --wrap without
per-call-site if branching. The show-side renderer
(write_show in src/bin/ktstr.rs) calls the underlying
helpers directly through the same branch.
Sourcepub fn new_constrained_table(&self, max_widths: &[u16]) -> Table
pub fn new_constrained_table(&self, max_widths: &[u16]) -> Table
Create a table constrained to the given max content widths. Heading rows wider than data get auto-truncated by comfy_table with its built-in “…” indicator.
Trait Implementations§
Source§impl Clone for DisplayOptions
impl Clone for DisplayOptions
Source§fn clone(&self) -> DisplayOptions
fn clone(&self) -> DisplayOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DisplayOptions
impl Debug for DisplayOptions
Source§impl Default for DisplayOptions
impl Default for DisplayOptions
Source§fn default() -> DisplayOptions
fn default() -> DisplayOptions
Auto Trait Implementations§
impl Freeze for DisplayOptions
impl RefUnwindSafe for DisplayOptions
impl Send for DisplayOptions
impl Sync for DisplayOptions
impl Unpin for DisplayOptions
impl UnwindSafe for DisplayOptions
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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