Struct Steer
struct Steer<S, F, Req> { ... }
Steer manages a list of Services which all handle the same type of request.
An example use case is a sharded service. It accepts new requests, then:
- Determines, via the provided
Picker, whichServicethe request corresponds to. - Waits (in
Service::poll_ready) for all services to be ready. - Calls the correct
Servicewith the request, and returns a future corresponding to the call.
Note that Steer must wait for all services to be ready since it can't know ahead of time
which Service the next message will arrive for, and is unwilling to buffer items
indefinitely. This will cause head-of-line blocking unless paired with a Service that does
buffer items indefinitely, and thus always returns Poll::Ready. For example, wrapping each
component service with a Buffer with a high enough limit (the maximum number of concurrent
requests) will prevent head-of-line blocking in Steer.
Implementations
impl<S, F, Req> Steer<S, F, Req>
fn new<impl IntoIterator<Item = S>: IntoIterator<Item = S>>(services: impl IntoIterator<Item = S>, router: F) -> SelfMake a new
Steerwith a list ofService's and aPicker.Note: the order of the
Service's is significant forPicker::pick's return value.
impl<M, S, Target, Request> MakeService for Steer<S, F, Req>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<S, F, Req> Clone for Steer<S, F, Req>
fn clone(self: &Self) -> Self
impl<S, F, Req> Debug for Steer<S, F, Req>
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl<S, F, Req> Freeze for Steer<S, F, Req>
impl<S, F, Req> RefUnwindSafe for Steer<S, F, Req>
impl<S, F, Req> Send for Steer<S, F, Req>
impl<S, F, Req> Sync for Steer<S, F, Req>
impl<S, F, Req> Unpin for Steer<S, F, Req>
impl<S, F, Req> UnwindSafe for Steer<S, F, Req>
impl<S, Req, F> Service for Steer<S, F, Req>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>fn call(self: &mut Self, req: Req) -> <Self as >::Future
impl<T> Any for Steer<S, F, Req>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Steer<S, F, Req>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Steer<S, F, Req>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Steer<S, F, Req>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Steer<S, F, Req>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Steer<S, F, Req>
impl<T> ToOwned for Steer<S, F, Req>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for Steer<S, F, Req>
impl<T, Request> ServiceExt for Steer<S, F, Req>
impl<T, U> Into for Steer<S, F, Req>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Steer<S, F, Req>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Steer<S, F, Req>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>