pub struct Outcome {
pub ok: bool,
pub lines: Vec<String>,
pub columns: Vec<String>,
pub rows: Vec<Vec<String>>,
pub data: Option<Value>,
}Expand description
一次动作的答复。四样:通不通、话、表格、给界面的那一栏。
Fields§
§ok: bool§lines: Vec<String>给人看的话,一行一句。
columns: Vec<String>同一份表格:表头与行,命令行与窗口共用。
rows: Vec<Vec<String>>§data: Option<Value>给窗口与脚本的那一栏(要交原文就托在这里);没有就不写。
Implementations§
Source§impl Outcome
impl Outcome
pub fn new(ok: bool) -> Self
Sourcepub fn with_first(self, line: String) -> Self
pub fn with_first(self, line: String) -> Self
往话的开头添一句。
Sourcepub fn to_output_json(&self) -> Json
pub fn to_output_json(&self) -> Json
原文那一栏(--out 落的就是它);没托东西就给信封。
Sourcepub fn from_stdout(stdout: &str) -> Result<Outcome>
pub fn from_stdout(stdout: &str) -> Result<Outcome>
命令行吐的 JSON 直接装回来(反操作是 Outcome::to_json)。
Trait Implementations§
impl StructuralPartialEq for Outcome
Auto Trait Implementations§
impl Freeze for Outcome
impl RefUnwindSafe for Outcome
impl Send for Outcome
impl Sync for Outcome
impl Unpin for Outcome
impl UnsafeUnpin for Outcome
impl UnwindSafe for Outcome
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