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

The success value type.

Required Methods

Flattens the inner protocol, possibly containing an error type into the common result type.

Implementations on Foreign Types

impl<T, E> Flatten for Result<Result<T, E>, Error> where
    E: Into<Error>, 
[src]

impl<T> Flatten for Result<Streaming<T>, Error>
[src]

Implementors