pub trait Response: Sized + __Classify {
type Payload;
// Required methods
fn ok(payload: Self::Payload) -> Self;
fn err(msg: impl Into<String>) -> Self;
fn is_ok(&self) -> bool;
fn into_result(self) -> Result<Self::Payload, String>;
// Provided methods
fn is_err(&self) -> bool { ... }
fn from_result(result: Result<Self::Payload, String>) -> Self { ... }
fn error_msg(&self) -> Option<String> { ... }
fn then<J>(self, jig: J) -> J::Out
where J: Jig<Self>,
J::Out: Response { ... }
}Expand description
An outbound message produced by a pipeline.
Types implementing this trait wrap a Result so that downstream jigs can
short-circuit on error.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn from_result(result: Result<Self::Payload, String>) -> Self
fn from_result(result: Result<Self::Payload, String>) -> Self
Wrap a Result into a response.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.