Trait ProxyDB
pub trait ProxyDB:
Send
+ Sync
+ 'static {
type Error: Send + Sync + 'static;
// Required method
fn get_proxy_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send;
// Provided method
fn get_proxy(
&self,
ctx: ProxyContext,
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: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
fn get_proxy_if( &self, ctx: ProxyContext, 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: ProxyContext,
filter: ProxyFilter,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
fn get_proxy( &self, ctx: ProxyContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send
Get a Proxy
based on the given ProxyContext
and ProxyFilter
,
or return an error in case no Proxy
could be returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.