pub trait ProxyDB:
Send
+ Sync
+ 'static {
type Error: Send + Sync + 'static;
// Required method
fn get_proxy_if(
&self,
ctx: TransportContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send;
// Provided method
fn get_proxy(
&self,
ctx: TransportContext,
filter: ProxyFilter,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send { ... }
}
Expand description
The trait to implement to provide a proxy database to other facilities,
such as connection pools, to provide a proxy based on the given
TransportContext
and ProxyFilter
.
Required Associated Types§
Required Methods§
fn get_proxy_if(
&self,
ctx: TransportContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
Same as Self::get_proxy
but with a predicate
to filter out found proxies that do not match the given predicate.
Provided Methods§
fn get_proxy(
&self,
ctx: TransportContext,
filter: ProxyFilter,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
Get a Proxy
based on the given TransportContext
and ProxyFilter
,
or return an error in case no Proxy
could be returned.
Object Safety§
This trait is not object safe.