Trait rama::http::layer::classify::ClassifyEos

pub trait ClassifyEos {
    type FailureClass;

    // Required methods
    fn classify_eos(
        self,
        trailers: Option<&HeaderMap>,
    ) -> Result<(), Self::FailureClass>;
    fn classify_error<E>(self, error: &E) -> Self::FailureClass
       where E: Display;

    // Provided method
    fn map_failure_class<F, NewClass>(self, f: F) -> MapFailureClass<Self, F>
       where Self: Sized,
             F: FnOnce(Self::FailureClass) -> NewClass { ... }
}
Expand description

Trait for classifying end of streams (EOS) as either success or failure.

Required Associated Types§

type FailureClass

The type of failure classifications.

Required Methods§

fn classify_eos( self, trailers: Option<&HeaderMap>, ) -> Result<(), Self::FailureClass>

Perform the classification from response trailers.

fn classify_error<E>(self, error: &E) -> Self::FailureClass
where E: Display,

Classify an error.

Errors are always errors (doh) but sometimes it might be useful to have multiple classes of errors. A retry policy might allow retrying some errors and not others.

Provided Methods§

fn map_failure_class<F, NewClass>(self, f: F) -> MapFailureClass<Self, F>
where Self: Sized, F: FnOnce(Self::FailureClass) -> NewClass,

Transform the failure classification using a function.

See ClassifyResponse::map_failure_class for more details.

Object Safety§

This trait is not object safe.

Implementors§

§

impl ClassifyEos for GrpcEosErrorsAsFailures

§

impl<C, F, NewClass> ClassifyEos for MapFailureClass<C, F>
where C: ClassifyEos, F: FnOnce(<C as ClassifyEos>::FailureClass) -> NewClass,

§

type FailureClass = NewClass

§

impl<T> ClassifyEos for NeverClassifyEos<T>