Skip to main content

ResultPayloadTrait

Trait ResultPayloadTrait 

Source
pub trait ResultPayloadTrait: PayloadTrait<JsonType = Result<Self::OkType>> {
    type OkType: Serialize + DeserializeOwned + Debug;

    // Provided methods
    fn from_ec(ec: ErrorCode) -> Self { ... }
    fn into_result(self) -> Result<Self> { ... }
    fn from_result(res: Result<Self>) -> Self { ... }
}
Expand description

What’s expected from a EndpointDetails::ResponseType.

Or: trait for those PayloadTraits that have a PayloadTrait::JsonType of the form Result<T>, and for which Self::from_payload(Payload::Json(Err(..))) and Self::from_payload(Self::into_payload()) never fail.

Required Associated Types§

Provided Methods§

Source

fn from_ec(ec: ErrorCode) -> Self

Create an instance of this result payload type from the given ErrorCode infallibly.

Source

fn into_result(self) -> Result<Self>

Destructs this payload result, extracting any error.

Source

fn from_result(res: Result<Self>) -> Self

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.

Implementors§