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,value2Example 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
impl Dataview
Sourcepub fn row_header(&self) -> &str
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");Sourcepub fn headline(&self, key: &str) -> Option<&String>
pub fn headline(&self, key: &str) -> Option<&String>
Returns a headline value by key, if present.
Sourcepub fn headline_order(&self) -> &[String]
pub fn headline_order(&self) -> &[String]
Returns the headline keys in display order.
Sourcepub fn value(&self, row: &str, column: &str) -> Option<&String>
pub fn value(&self, row: &str, column: &str) -> Option<&String>
Returns a cell value for the given row/column, if present.
Sourcepub fn column_order(&self) -> &[String]
pub fn column_order(&self) -> &[String]
Returns the column names in display order.
Source§impl Dataview
impl Dataview
Sourcepub fn builder() -> DataviewBuilder
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§
impl Eq for Dataview
impl StructuralPartialEq for Dataview
Auto Trait Implementations§
impl Freeze for Dataview
impl RefUnwindSafe for Dataview
impl Send for Dataview
impl Sync for Dataview
impl Unpin for Dataview
impl UnwindSafe for Dataview
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
Mutably borrows from an owned value. Read more