pub struct Report {
pub name: String,
pub window: TimeWindow,
pub table: Table,
pub json_rows: Vec<Value>,
pub notes: Vec<String>,
pub text: Option<String>,
}Expand description
One report, rendered either way.
rows (the table) and json_rows (the envelope) are kept separate on
purpose: the table is formatted for a human, the JSON stays raw so a harness
can do its own arithmetic on it.
Fields§
§name: StringThe stable report name, e.g. "projects".
window: TimeWindow§table: Table§json_rows: Vec<Value>§notes: Vec<String>§text: Option<String>Pre-rendered human form, for commands whose output is prose rather than
a table (ingest, doctor). When set it replaces the table in non-JSON
mode; the envelope is unaffected either way.
Implementations§
Source§impl Report
impl Report
pub fn new(name: impl Into<String>, window: TimeWindow, table: Table) -> Self
Sourcepub fn prose(name: impl Into<String>, window: TimeWindow, text: String) -> Self
pub fn prose(name: impl Into<String>, window: TimeWindow, text: String) -> Self
A report whose human form is prose. It still goes out through emit,
so --json remains a single parseable document with no table alongside.
pub fn with_json_rows(self, rows: Vec<Value>) -> Self
pub fn with_notes<S: Into<String>>( self, notes: impl IntoIterator<Item = S>, ) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Report
impl RefUnwindSafe for Report
impl Send for Report
impl Sync for Report
impl Unpin for Report
impl UnsafeUnpin for Report
impl UnwindSafe for Report
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