Crate tower_async_bridge
source ·Expand description
Tower Async Bridge traits and extensions.
You can make use of this crate in order to:
- Turn a
tower::Service
into atower_async::Service
(requires theinto_async
feature); - Turn a
tower_async::Service
into atower::Service
; - Use a
tower_async::Layer
within atower
environment (e.g.tower::ServiceBuilder
); - Use a
tower::Layer
within atower_async
environment (e.g.tower_async::ServiceBuilder
) (requires theinto_async
feature);
Please check the crate’s unit tests and examples to see specifically how to use the crate in order to achieve this.
Furthermore we also urge you to only use this kind of approach for transition purposes and not as a permanent way of life. Best in our opinion is to use one or the other and not to combine the two. But if you do absolutely must use one combined with the other, this crate should allow you to do exactly that.
Structs
- A wrapper around a
tower_layer::Layer
that implementstower_async_layer::Layer
and is the type returned by AsyncLayerExt::into_async. - A wrapper around a
tower_service::Service
that implementstower_async_service::Service
. - A wrapper around a
tower_layer::Layer
that implementstower_async_layer::Layer
and is the type returned by ClassicLayerExt::into_classic. - Service returned by crate::ClassicServiceExt::into_classic.
Traits
- AsyncLayerExt adds a method to any
tower_layer::Layer
that wraps it in an AsyncLayer so that it can be used within atower_async_layer::Layer
environment. - Extension for a
tower::Service
to turn it into an asyncService
. - ClassicLayerExt adds a method to any
tower_async_layer::Layer
that wraps it in a ClassicLayer so that it can be used within atower_layer::Layer
environment. - Extension trait for
tower::Service
that provides the ClassicServiceExt::into_classic method.