pub struct Answer {
pub code: u8,
pub out: Value,
pub error: String,
}Expand description
The answer to a call: what to print, and the code to end with.
Fields§
§code: u8§out: ValuePrinted as it is when it’s text, as JSON otherwise.
error: StringSaid on stderr, with what to do next.
Implementations§
Source§impl Answer
impl Answer
pub fn ok(out: Value) -> Self
pub fn fail(code: u8, error: impl Into<String>) -> Self
Sourcepub fn with(self, out: Value) -> Self
pub fn with(self, out: Value) -> Self
With something to print as well, as a check-in says where things stand.
Sourcepub fn noting(self, note: impl Into<String>) -> Self
pub fn noting(self, note: impl Into<String>) -> Self
Ok all the same, with a note said on stderr.
pub fn line(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Answer
impl<'de> Deserialize<'de> for Answer
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
impl StructuralPartialEq for Answer
Auto Trait Implementations§
impl Forget for Answer
impl Freeze for Answer
impl Move for Answer
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnsafeUnpin for Answer
impl UnwindSafe for Answer
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