Dataview

Struct Dataview 

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

A Geneos Dataview object.

This struct represents a Dataview, which is a structured representation of data with a row header, headlines, and values.

Example Dataview format:

row_header,column1,column2
<!>headline1,value1
<!>headline2,value2
row1,value1,value2
row2,value1,value2

Example with data:

cpu,percentUtilisation,percentIdle
<!>numOnlineCpus,2
<!>loadAverage1Min,0.32
<!>loadAverage5Min,0.45
<!>loadAverage15Min,0.38
<!>HyperThreadingStatus,ENABLED
Average_cpu,3.75 %,96.25 %
cpu_0,3.25 %,96.75 %
cpu_0_logical#1,2.54 %,97.46 %
cpu_0_logical#2,2.54 %,97.46 %

Implementations§

Source§

impl Dataview

Source

pub fn row_header(&self) -> &str

Returns the row header label for this dataview.

§Example
use geneos_toolkit::dataview::DataviewBuilder;
let view = DataviewBuilder::new()
    .set_row_header("Process")
    .add_value("proc1", "Status", "Running")
    .build()
    .unwrap();
assert_eq!(view.row_header(), "Process");
Source

pub fn headline(&self, key: &str) -> Option<&String>

Returns a headline value by key, if present.

Source

pub fn headline_order(&self) -> &[String]

Returns the headline keys in display order.

Source

pub fn value(&self, row: &str, column: &str) -> Option<&String>

Returns a cell value for the given row/column, if present.

Source

pub fn column_order(&self) -> &[String]

Returns the column names in display order.

Source

pub fn row_order(&self) -> &[String]

Returns the row names in display order.

Source§

impl Dataview

Source

pub fn builder() -> DataviewBuilder

Creates a new DataviewBuilder instance

This allows users to create a Dataview without explicitly importing DataviewBuilder

§Example
use geneos_toolkit::prelude::*;
let dataview = Dataview::builder()
    .set_row_header("ID")
    .add_headline("Total", "42")
    .add_value("1", "Name", "Alice")
    .build();

Trait Implementations§

Source§

impl Clone for Dataview

Source§

fn clone(&self) -> Dataview

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 Dataview

Source§

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

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

impl Default for Dataview

Source§

fn default() -> Dataview

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

impl Display for Dataview

Source§

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

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

impl PartialEq for Dataview

Source§

fn eq(&self, other: &Dataview) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Dataview

Source§

impl StructuralPartialEq for Dataview

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.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.