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: impl ToString) -> Self
pub fn add_headline<S: ToString>(self, key: S, value: S) -> Self
pub fn add_value<S: ToString>(self, row: S, column: S, value: S) -> 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 value 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