DisplayOptions

Struct DisplayOptions 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§format: DisplayFormat

Format 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: bool

When 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: usize

Maximum 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

Source

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.

Source

pub fn resolved_show_columns(&self) -> Vec<Column>

Resolved show-side column set: columns if non-empty, otherwise show_columns_default.

Source

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.

Source

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

Source

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.

Source

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

Source§

fn clone(&self) -> DisplayOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DisplayOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DisplayOptions

Source§

fn default() -> DisplayOptions

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,