Trait cocaine::protocol::Flatten
[−]
[src]
pub trait Flatten { type Item; fn flatten(self) -> Result<Self::Item, Error>; }
An extension trait for results, that contain error types itself, to be able to flatten the result of deserialization and protocol errors.
For example when deserializing a Primitive
result either deserialization or service error can
occur, which results in Result<Result<T, protocol::Error>, Error>
type. To avoid explicit
double matching the inner result can be flatten into the outer one.
Associated Types
type Item
The success value type.
Required Methods
fn flatten(self) -> Result<Self::Item, Error>
Flattens the inner protocol, possibly containing an error type into the common result type.