Trait ServiceExt

Source
pub trait ServiceExt {
    // Provided methods
    fn trace_for_http(self) -> Trace<Self, HttpMakeClassifier>
       where Self: Sized { ... }
    fn trace_for_grpc(self) -> Trace<Self, GrpcMakeClassifier>
       where Self: Sized { ... }
    fn override_request_header<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetRequestHeader<Self, M>
       where Self: Sized { ... }
    fn append_request_header<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetRequestHeader<Self, M>
       where Self: Sized { ... }
    fn insert_request_header_if_not_present<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetRequestHeader<Self, M>
       where Self: Sized { ... }
    fn override_response_header<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetResponseHeader<Self, M>
       where Self: Sized { ... }
    fn append_response_header<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetResponseHeader<Self, M>
       where Self: Sized { ... }
    fn insert_response_header_if_not_present<M>(
        self,
        header_name: HeaderName,
        make: M,
    ) -> SetResponseHeader<Self, M>
       where Self: Sized { ... }
    fn set_request_id<M>(
        self,
        header_name: HeaderName,
        make_request_id: M,
    ) -> SetRequestId<Self, M>
       where Self: Sized,
             M: MakeRequestId { ... }
    fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>
       where Self: Sized,
             M: MakeRequestId { ... }
    fn propagate_request_id(
        self,
        header_name: HeaderName,
    ) -> PropagateRequestId<Self>
       where Self: Sized { ... }
    fn propagate_x_request_id(self) -> PropagateRequestId<Self>
       where Self: Sized { ... }
}
Expand description

Extension trait that adds methods to any Service for adding middleware from tower-http.

Provided Methods§

Source

fn trace_for_http(self) -> Trace<Self, HttpMakeClassifier>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes.

This method does not support customizing the output, to do that use TraceLayer instead.

See tower_http::trace for more details.

Source

fn trace_for_grpc(self) -> Trace<Self, GrpcMakeClassifier>
where Self: Sized,

High level tracing that classifies responses using gRPC headers.

This method does not support customizing the output, to do that use TraceLayer instead.

See tower_http::trace for more details.

Source

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request.

If a previous value exists for the same header, it is removed and replaced with the new header value.

See tower_http::set_header for more details.

Source

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request.

If previous values exist, the header will have multiple values.

See tower_http::set_header for more details.

Source

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present.

See tower_http::set_header for more details.

Source

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response.

If a previous value exists for the same header, it is removed and replaced with the new header value.

See tower_http::set_header for more details.

Source

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response.

If previous values exist, the header will have multiple values.

See tower_http::set_header for more details.

Source

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present.

See tower_http::set_header for more details.

Source

fn set_request_id<M>( self, header_name: HeaderName, make_request_id: M, ) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Add request id header and extension.

See tower_http::request_id for more details.

Source

fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>
where Self: Sized, M: MakeRequestId,

Add request id header and extension, using x-request-id as the header name.

See tower_http::request_id for more details.

Source

fn propagate_request_id( self, header_name: HeaderName, ) -> PropagateRequestId<Self>
where Self: Sized,

Propgate request ids from requests to responses.

See tower_http::request_id for more details.

Source

fn propagate_x_request_id(self) -> PropagateRequestId<Self>
where Self: Sized,

Propgate request ids from requests to responses, using x-request-id as the header name.

See tower_http::request_id for more details.

Implementors§

Source§

impl<T> ServiceExt for T