pub enum ResultView {
Table {
title: String,
columns: Vec<String>,
rows: Vec<Vec<Value>>,
},
Chart {
title: String,
x: Axis,
series: Vec<Line>,
},
Text {
title: String,
text: String,
},
Tiles {
title: String,
dir: Dir,
tiles: Vec<ResultView>,
},
}Variants§
Implementations§
Source§impl ResultView
impl ResultView
Sourcepub fn from_plugin(v: Value) -> Result<(ResultView, Vec<String>)>
pub fn from_plugin(v: Value) -> Result<(ResultView, Vec<String>)>
Parse and check a view sent by a plugin; overlong tables and charts are cut (the returned notes say so).
pub fn title(&self) -> &str
Sourcepub fn leaves(&self) -> Vec<&ResultView>
pub fn leaves(&self) -> Vec<&ResultView>
The leaf views, in order.
Sourcepub fn summary(&self) -> String
pub fn summary(&self) -> String
One line: table (3 columns, 20 rows), chart (2 lines, 500 points), …
Sourcepub fn as_table(&self) -> (Vec<String>, Vec<Vec<String>>)
pub fn as_table(&self) -> (Vec<String>, Vec<Vec<String>>)
The view as a table (a chart lists x and its lines; text has one column).
Sourcepub fn as_chart(&self) -> Option<(Axis, Vec<Line>)>
pub fn as_chart(&self) -> Option<(Axis, Vec<Line>)>
The view as chart lines: a chart as is; a table’s number columns against its first
column (or the row number). None when there is nothing to draw.
Sourcepub fn text_lines(&self, rows: usize) -> Vec<String>
pub fn text_lines(&self, rows: usize) -> Vec<String>
Plain text for a terminal (mnnn code run): tables are cut to rows rows and
charts get a sparkline per line.
Trait Implementations§
Source§impl Clone for ResultView
impl Clone for ResultView
Source§impl Debug for ResultView
impl Debug for ResultView
Source§impl<'de> Deserialize<'de> for ResultView
impl<'de> Deserialize<'de> for ResultView
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ResultView
impl PartialEq for ResultView
Source§impl Serialize for ResultView
impl Serialize for ResultView
impl StructuralPartialEq for ResultView
Auto Trait Implementations§
impl Forget for ResultView
impl Freeze for ResultView
impl Move for ResultView
impl RefUnwindSafe for ResultView
impl Send for ResultView
impl Sync for ResultView
impl Unpin for ResultView
impl UnsafeUnpin for ResultView
impl UnwindSafe for ResultView
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