Trait tokio_tower::MakeTransport [−][src]
Creates new Transport
(i.e., Sink + Stream
) instances.
Acts as a transport factory. This is useful for cases where new Sink + Stream
values must be produced.
This is essentially a trait alias for a Service
of Sink + Stream
s.
Associated Types
type Item
[src]
Items produced by the transport
type Error
[src]
Errors produced when receiving from the transport
type SinkError
[src]
Errors produced when sending to the transport
type Transport: TryStream<Ok = Self::Item, Error = Self::Error> + Sink<Request, Error = Self::SinkError>
[src]
The Sink + Stream
implementation created by this factory
type MakeError
[src]
Errors produced while building a transport.
type Future: Future<Output = Result<Self::Transport, Self::MakeError>>
[src]
The future of the Service
instance.
Required methods
fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::MakeError>>
[src]
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::MakeError>>
Returns Ready
when the factory is able to create more transports.
If the service is at capacity, then NotReady
is returned and the task
is notified when the service becomes ready again. This function is
expected to be called while on a task.
This is a best effort implementation. False positives are permitted.
It is permitted for the service to return Ready
from a poll_ready
call and the next invocation of make_transport
results in an error.
fn make_transport(&mut self, target: Target) -> Self::Future
[src]
Create and return a new transport asynchronously.
Implementors
impl<M, T, Target, Request> MakeTransport<Target, Request> for M where
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
[src]
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
type Item = <T as TryStream>::Ok
type Error = <T as TryStream>::Error
type SinkError = <T as Sink<Request>>::Error
type Transport = T
type MakeError = M::Error
type Future = M::Future
fn poll_ready(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::MakeError>>
[src]
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(), Self::MakeError>>