axum_test::transport_layer

Trait IntoTransportLayer

Source
pub trait IntoTransportLayer: Sized {
    // Required methods
    fn into_http_transport_layer(
        self,
        builder: TransportLayerBuilder,
    ) -> Result<Box<dyn TransportLayer>>;
    fn into_mock_transport_layer(self) -> Result<Box<dyn TransportLayer>>;

    // Provided method
    fn into_default_transport(
        self,
        _builder: TransportLayerBuilder,
    ) -> Result<Box<dyn TransportLayer>> { ... }
}
Expand description

This exists to unify how to send mock or real messages to different services. This includes differences between Router, IntoMakeService, and IntoMakeServiceWithConnectInfo.

Implementing this will allow you to use the TestServer against other types.

Warning, this trait may change in a future release.

Required Methods§

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IntoTransportLayer for Router<()>

Source§

impl IntoTransportLayer for AxumService

Available on crate feature shuttle only.
Source§

impl IntoTransportLayer for ShuttleAxum

Available on crate feature shuttle only.
Source§

impl<M, S> IntoTransportLayer for Serve<M, S>
where M: for<'a> Service<IncomingStream<'a>, Error = Infallible, Response = S> + Send + 'static, for<'a> <M as Service<IncomingStream<'a>>>::Future: Send, S: Service<Request, Response = Response, Error = Infallible> + Clone + Send + 'static, S::Future: Send,

Source§

impl<M, S, F> IntoTransportLayer for WithGracefulShutdown<M, S, F>
where M: for<'a> Service<IncomingStream<'a>, Error = Infallible, Response = S> + Send + 'static, for<'a> <M as Service<IncomingStream<'a>>>::Future: Send, S: Service<Request, Response = Response, Error = Infallible> + Clone + Send + 'static, S::Future: Send, F: Future<Output = ()> + Send + 'static,

Source§

impl<S> IntoTransportLayer for IntoMakeService<S>
where S: Service<Request, Response = Response, Error = Infallible> + Clone + Send + Sync + 'static, S::Future: Send,

Source§

impl<S, C> IntoTransportLayer for IntoMakeServiceWithConnectInfo<S, C>
where for<'a> C: Connected<IncomingStream<'a>>, S: Service<Request, Response = Response, Error = Infallible> + Clone + Send + 'static, S::Future: Send,

Implementors§