Render

Struct Render 

Source
pub struct Render<C> {
    pub aggregate: Aggregate,
    pub width_hint: usize,
    pub show_aggregate: bool,
    pub abbreviate_breakdown: bool,
    pub positive_marker: char,
    pub negative_marker: char,
    pub widget_config: C,
}
Expand description

The general configuration for rendering a flat widget.

§Example

let config = Render {
    aggregate: Aggregate::Average,
    width_hint: 10,
    show_aggregate: true,
    abbreviate_breakdown: true,
    positive_marker: '+',
    negative_marker: '-',
    widget_config: HistogramConfig::default(),
    ..Render::default()
};

Fields§

§aggregate: Aggregate

The function to apply when aggregating values in the widget.

Default: Aggregate::Sum.

§width_hint: usize

The hint to use to determine the width of the rendering. Flat will try to make the rendering at most width_hint wide, with some exceptions:

  • If the rendering can reasonably fit in a smaller width, the width_hint is ignored.
  • If the rendering cannot reasonably fit the width_hint, then it is minimally extended (such that a reasonable rendering may be produced).

Default: 160.

§show_aggregate: bool

Whether to show the aggregated result for the primary dimension of the dataset. While the rendered data in flat uses a relative representation, this option extends the widget to show the absolute values of the data.

r#"
Show Aggregate          | Rendering of Aggregate
aggregate([1, 2, 3, 4]) | aggregate([1, 2, 3, 4])"#

In the case of a breakdown, this represents the aggregate applied to the breakdown aggregates.

r#"
Show Aggregate                                    | Rendering of Aggregate of A | Rendering of Aggregate of B |
aggregate([aggregate([1, 2, 3]), aggregate([4])]) | aggregate([1, 2, 3])        | aggregate([4])              |"#

Default: false.

§abbreviate_breakdown: bool

Whether to abbreviate the column headings (which come from dimensional values) in the breakdown or not. Use this option when the breakdown dimensions have long std::fmt::Display forms. Abbreviation is attempted irrespective of the width_hint.

Default: false.

§positive_marker: char

The marker character for positive values of the rendering.

Default: '*'.

§negative_marker: char

The marker character for negative values of the rendering.

Default: '⊖'.

§widget_config: C

The widget specific rendering configuration.

Default: C::default().

Trait Implementations§

Source§

impl<C: Debug> Debug for Render<C>

Source§

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

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

impl<C: Default> Default for Render<C>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Render<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for Render<C>
where C: RefUnwindSafe,

§

impl<C> Send for Render<C>
where C: Send,

§

impl<C> Sync for Render<C>
where C: Sync,

§

impl<C> Unpin for Render<C>
where C: Unpin,

§

impl<C> UnwindSafe for Render<C>
where C: UnwindSafe,

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.