pub enum Outcome<V = Rest> {
Ok(V),
NotStarted(String),
Interrupted(String),
NetworkError {
sent: bool,
reason: String,
},
}Expand description
A reply’s answer: a number and what follows it (errors.md, Tool
problems, says what each claims).
On the wire the value is in the value encoding, V = Rest, read at
the call’s result type once the reply’s key has named the call; an
implementation in the host’s own process answers with the value
itself, and an adapter that speaks JSON, or a reply supplied in JSON,
with its JSON form.
Variants§
Ok(V)
A value of the Tool’s result type.
NotStarted(String)
The work did not begin, and why.
Interrupted(String)
The work began and stopped before a value, and why.
NetworkError
The network to the Tool failed; sent says whether the request
went out.
Implementations§
Source§impl Outcome<Json>
impl Outcome<Json>
Sourcepub fn json(&self) -> Json
pub fn json(&self) -> Json
The outcome in its JSON form, a value of Result<R, ToolProblem>
(abi.md, The JSON form), as Outcome::from_json reads it.
Sourcepub fn from_json(json: &Json) -> Result<Self, String>
pub fn from_json(json: &Json) -> Result<Self, String>
Reads an outcome in its JSON form: {"Ok": value},
{"Err": {"NotStarted": reason}}, {"Err": {"Interrupted": reason}}
or {"Err": {"NetworkError": {"sent", "reason"}}}, as a reply supplied
in JSON is written. The Ok value stays in its JSON form, to be
decoded at the call’s result type.
§Errors
Why it is none of those.
Trait Implementations§
impl<V: Eq> Eq for Outcome<V>
Source§impl<V: Wire> Keyed for Outcome<V>
impl<V: Wire> Keyed for Outcome<V>
Source§fn payload<'a>(&'a self, parts: &mut Vec<&'a dyn AnyWire>)
fn payload<'a>(&'a self, parts: &mut Vec<&'a dyn AnyWire>)
parts, in the order they are
written, without its constructor’s number.Source§fn open_payload(number: u64, at: usize) -> Result<Opened, DecodeError>
fn open_payload(number: u64, at: usize) -> Result<Opened, DecodeError>
Source§fn payload_bytes(&self) -> Vec<u8> ⓘ
fn payload_bytes(&self) -> Vec<u8> ⓘ
Source§fn decode_payload(number: u64, bytes: &[u8]) -> Result<Self, DecodeError>
fn decode_payload(number: u64, bytes: &[u8]) -> Result<Self, DecodeError>
number whose
payload bytes hold, and nothing else. Read moreSource§impl<V: Shaped> Shaped for Outcome<V>
impl<V: Shaped> Shaped for Outcome<V>
Source§fn write_at(
&self,
catalog: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, catalog: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Source§fn read_at(
catalog: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>
fn read_at( catalog: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>
impl<V: PartialEq> StructuralPartialEq for Outcome<V>
Source§impl<V: Wire> Wire for Outcome<V>
impl<V: Wire> Wire for Outcome<V>
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
out, and pushes
its parts to parts in the order they are written after them.Source§fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
reader: the value itself when it has no parts,
else its parts to read and what joins them. Read moreSource§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
out: its head, and then each part’s bytes in
order, written over a stack on the heap, so a value nested however
deep is written on a native stack of fixed size.Auto Trait Implementations§
impl<V> Forget for Outcome<V>
impl<V> Freeze for Outcome<V>
impl<V> Move for Outcome<V>
impl<V> RefUnwindSafe for Outcome<V>where
V: RefUnwindSafe,
impl<V> Send for Outcome<V>
impl<V> Sync for Outcome<V>
impl<V> Unpin for Outcome<V>
impl<V> UnsafeUnpin for Outcome<V>
impl<V> UnwindSafe for Outcome<V>where
V: UnwindSafe,
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> AnyWire for Twhere
T: Wire,
impl<T> AnyWire for Twhere
T: Wire,
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
Wire::write_head.