pub struct DataviewBuilder { /* private fields */ }Expand description
A Builder for the Dataview struct.
Implementations§
Source§impl DataviewBuilder
impl DataviewBuilder
pub fn new() -> Self
pub fn set_row_header(self, row_header: &str) -> Self
pub fn add_headline<T: ToString>(self, key: &str, value: T) -> Self
pub fn add_value<T: ToString>(self, row: &str, column: &str, value: T) -> Self
Sourcepub fn build(self) -> Result<Dataview, DataviewError>
pub fn build(self) -> Result<Dataview, DataviewError>
Builds the Dataview, consuming the builder.
The row_header must be set before the build or a panic will occur.
There must be at least one value.
Headlines are optional.
The order of the columns and rows is determined by the order in which they are added through
values using the add_value method.
The order of headlines is determined by the order in which they are added through the
add_headline method.
Example:
use geneos_toolkit::prelude::*;
let view: Dataview = Dataview::builder()
.set_row_header("Name")
.add_headline("AverageAge", "30")
.add_value("Anna", "Age", "30")
.add_value("Bertil", "Age", "20")
.add_value("Caesar", "Age", "40")
.build()
.unwrap();
Trait Implementations§
Source§impl Clone for DataviewBuilder
impl Clone for DataviewBuilder
Source§fn clone(&self) -> DataviewBuilder
fn clone(&self) -> DataviewBuilder
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DataviewBuilder
impl Debug for DataviewBuilder
Source§impl Default for DataviewBuilder
impl Default for DataviewBuilder
Source§fn default() -> DataviewBuilder
fn default() -> DataviewBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DataviewBuilder
impl RefUnwindSafe for DataviewBuilder
impl Send for DataviewBuilder
impl Sync for DataviewBuilder
impl Unpin for DataviewBuilder
impl UnwindSafe for DataviewBuilder
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