Skip to main content

Classifier

Trait Classifier 

Source
pub trait Classifier<T, E> {
    // Required method
    fn is_server_error(&self, result: &Result<T, E>) -> bool;
}
Expand description

Inspects the result of a service call to determine whether the outcome should be treated as a server error for concurrency-control purposes.

By default (DefaultClassifier), any Err variant is considered a server error. Implement this trait to distinguish client errors, expected failures, or successful-but-bad responses (e.g. HTTP 503) from true server errors.

Required Methods§

Source

fn is_server_error(&self, result: &Result<T, E>) -> bool

Implementors§

Source§

impl<F, T, E> Classifier<T, E> for F
where F: Fn(&Result<T, E>) -> bool,

Blanket impl: any closure Fn(&Result<T, E>) -> bool works as a classifier.

Source§

impl<T, E> Classifier<T, E> for DefaultClassifier