tower_discover

Trait Discover

Source
pub trait Discover {
    type Key: Hash + Eq;
    type Service;
    type Error;

    // Required method
    fn poll_discover(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>>;
}
Expand description

Provide a uniform set of services able to satisfy a request.

This set of services may be updated over time. On each change to the set, a new NewServiceSet is yielded by Discover.

See crate documentation for more details.

Required Associated Types§

Source

type Key: Hash + Eq

NewService key

Source

type Service

The type of Service yielded by this Discover.

Source

type Error

Error produced during discovery

Required Methods§

Source

fn poll_discover( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>>

Yields the next discovery change set.

Implementations on Foreign Types§

Source§

impl<D: ?Sized + Discover + Unpin> Discover for &mut D

Source§

type Key = <D as Discover>::Key

Source§

type Service = <D as Discover>::Service

Source§

type Error = <D as Discover>::Error

Source§

fn poll_discover( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>>

Source§

impl<D: ?Sized + Discover + Unpin> Discover for Box<D>

Source§

type Key = <D as Discover>::Key

Source§

type Service = <D as Discover>::Service

Source§

type Error = <D as Discover>::Error

Source§

fn poll_discover( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>>

Source§

impl<P> Discover for Pin<P>
where P: Unpin + DerefMut, P::Target: Discover,

Source§

type Key = <<P as Deref>::Target as Discover>::Key

Source§

type Service = <<P as Deref>::Target as Discover>::Service

Source§

type Error = <<P as Deref>::Target as Discover>::Error

Source§

fn poll_discover( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Change<Self::Key, Self::Service>, Self::Error>>

Implementors§

Source§

impl<S, K, Svc> Discover for ServiceStream<S>
where K: Hash + Eq, S: TryStream<Ok = Change<K, Svc>>,

Source§

type Key = K

Source§

type Service = Svc

Source§

type Error = <S as TryStream>::Error

Source§

impl<T, U> Discover for ServiceList<T>
where T: IntoIterator<Item = U>,

Source§

type Key = usize

Source§

type Service = U

Source§

type Error = Never