Struct GrpcErrorsAsFailures
pub struct GrpcErrorsAsFailures { /* private fields */ }
Response classifier for gRPC responses.
gRPC doesn't use normal HTTP statuses for indicating success or failure but instead a special header that might appear in a trailer.
Responses are considered successful if
grpc-statusheader value contains a success value.grpc-statusheader is missing.grpc-statusheader value isn't a validString.grpc-statusheader value can't parsed into ani32.
All others are considered failures.
Implementations
impl GrpcErrorsAsFailures
fn new() -> SelfCreate a new
GrpcErrorsAsFailures.fn with_success(self, code: GrpcCode) -> SelfChange which gRPC codes are considered success.
Defaults to only considering
Okas success.Okwill always be considered a success.Example
Servers might not want to consider
Invalid ArgumentorNot Foundas failures since thats likely the clients fault:use ; let classifier = new .with_success .with_success;fn make_classifier() -> SharedClassifier<Self>Returns a
MakeClassifierthat producesGrpcErrorsAsFailures.This is a convenience function that simply calls
SharedClassifier::new.
Trait Implementations
impl ClassifyResponse for GrpcErrorsAsFailures
type FailureClass = GrpcFailureClass;type ClassifyEos = GrpcEosErrorsAsFailures;fn classify_response<B>(self, res: &Response<B>) -> ClassifiedResponse<Self::FailureClass, Self::ClassifyEos>fn classify_error<E>(self, error: &E) -> Self::FailureClass where E: Display + 'static,
impl Clone for GrpcErrorsAsFailures
fn clone(&self) -> GrpcErrorsAsFailures
impl Debug for GrpcErrorsAsFailures
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for GrpcErrorsAsFailures
fn default() -> Self
Auto Trait Implementations
impl Freeze for GrpcErrorsAsFailures
impl RefUnwindSafe for GrpcErrorsAsFailures
impl Send for GrpcErrorsAsFailures
impl Sync for GrpcErrorsAsFailures
impl Unpin for GrpcErrorsAsFailures
impl UnsafeUnpin for GrpcErrorsAsFailures
impl UnwindSafe for GrpcErrorsAsFailures
Blanket Implementations
impl<T> Any for GrpcErrorsAsFailures
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for GrpcErrorsAsFailures
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for GrpcErrorsAsFailures
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for GrpcErrorsAsFailures
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for GrpcErrorsAsFailures
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for GrpcErrorsAsFailures
impl<T> PolicyExt for GrpcErrorsAsFailures
where
T: ?Sized,
fn and<P, B, E>(self, other: P) -> And<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,fn or<P, B, E>(self, other: P) -> Or<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,
impl<T> ToOwned for GrpcErrorsAsFailures
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for GrpcErrorsAsFailures
impl<T, U> Into<U> for GrpcErrorsAsFailures
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for GrpcErrorsAsFailures
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for GrpcErrorsAsFailures
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>