pub struct Gateway<S> { /* private fields */ }Expand description
A builder and configuration struct for the Gateway runtime.
Wraps a Router and allows attaching various handlers and configuration options.
The into_service() method consumes this builder to produce the final Service.
Implementations§
Source§impl<S> Gateway<S>
impl<S> Gateway<S>
Sourcepub fn new(router: Router<S>) -> Self
pub fn new(router: Router<S>) -> Self
Creates a new Gateway wrapping the given Router and initialized with secure defaults.
Sourcepub fn with_error_handler<F>(self, handler: F) -> Self
pub fn with_error_handler<F>(self, handler: F) -> Self
Sets the custom error handler.
Sourcepub fn with_metadata<F>(self, annotator: F) -> Self
pub fn with_metadata<F>(self, annotator: F) -> Self
Adds a metadata annotator.
Sourcepub fn with_response_modifier<F>(self, modifier: F) -> Self
pub fn with_response_modifier<F>(self, modifier: F) -> Self
Adds a response modifier.
Sourcepub fn with_incoming_header_matcher<F>(self, matcher: F) -> Self
pub fn with_incoming_header_matcher<F>(self, matcher: F) -> Self
Sets the incoming header matcher.
Sourcepub fn with_outgoing_header_matcher<F>(self, matcher: F) -> Self
pub fn with_outgoing_header_matcher<F>(self, matcher: F) -> Self
Sets the outgoing header matcher.
Sourcepub fn with_unescaping_mode(self, mode: UnescapingMode) -> Self
pub fn with_unescaping_mode(self, mode: UnescapingMode) -> Self
Sets the unescaping mode.
Sourcepub fn with_auth_verifier<F>(self, verifier: F) -> Self
pub fn with_auth_verifier<F>(self, verifier: F) -> Self
Sets the authentication verifier.
Sourcepub fn with_metrics_recorder<F>(self, recorder: F) -> Self
pub fn with_metrics_recorder<F>(self, recorder: F) -> Self
Sets the metrics recorder.
Sourcepub fn with_tracing<Start, End>(self, start: Start, end: End) -> Self
pub fn with_tracing<Start, End>(self, start: Start, end: End) -> Self
Sets tracing handlers.
Sourcepub fn with_metadata_config(self, config: MetadataForwardingConfig) -> Self
pub fn with_metadata_config(self, config: MetadataForwardingConfig) -> Self
Sets the metadata forwarding configuration.
Sourcepub fn metadata_config(&self) -> &MetadataForwardingConfig
pub fn metadata_config(&self) -> &MetadataForwardingConfig
Returns a reference to the metadata configuration.
Source§impl<S> Gateway<S>where
S: Service<GatewayRequest, Response = GatewayResponse, Error = GatewayError> + Clone + Send + 'static,
S::Future: Send + 'static,
impl<S> Gateway<S>where
S: Service<GatewayRequest, Response = GatewayResponse, Error = GatewayError> + Clone + Send + 'static,
S::Future: Send + 'static,
Sourcepub fn into_service(
self,
) -> BoxCloneService<GatewayRequest, GatewayResponse, GatewayError>
pub fn into_service( self, ) -> BoxCloneService<GatewayRequest, GatewayResponse, GatewayError>
Consumes the Gateway configuration and returns a constructed tower::BoxCloneService.
This method assembles the complete middleware stack around the router.
Auto Trait Implementations§
impl<S> Freeze for Gateway<S>
impl<S> !RefUnwindSafe for Gateway<S>
impl<S> Send for Gateway<S>where
S: Send,
impl<S> Sync for Gateway<S>where
S: Sync,
impl<S> Unpin for Gateway<S>
impl<S> !UnwindSafe for Gateway<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request