Trait ProxyDB
pub trait ProxyDB:
Send
+ Sync
+ 'static {
type Error: Send + 'static;
// Required method
fn get_proxies_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
limit: Option<NonZero<usize>>,
) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send;
// Provided methods
fn get_proxies(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
limit: Option<NonZero<usize>>,
) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send { ... }
fn get_proxy_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send { ... }
fn get_proxy(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
) -> impl Future<Output = Result<Proxy, Self::Error>> + Send { ... }
}proxy only.Expand description
The trait to implement to provide a proxy database to other facilities,
such as connection pools, to provide proxy candidates based on the given
ProxyContext and ProxyFilter.
Required Associated Types§
Required Methods§
fn get_proxies_if(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
predicate: impl ProxyQueryPredicate,
limit: Option<NonZero<usize>>,
) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
fn get_proxies_if( &self, ctx: ProxyContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, limit: Option<NonZero<usize>>, ) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
Return matching Proxy values in database-defined preference order,
after applying an additional predicate and optional result limit.
Provided Methods§
fn get_proxies(
&self,
ctx: ProxyContext,
filter: ProxyFilter,
limit: Option<NonZero<usize>>,
) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
fn get_proxies( &self, ctx: ProxyContext, filter: ProxyFilter, limit: Option<NonZero<usize>>, ) -> impl Future<Output = Result<NonEmptyVec<Proxy>, Self::Error>> + Send
Return matching Proxy values in database-defined preference order,
up to the optional result limit.
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
Return one matching proxy after applying an additional predicate.
Implementations may override this to provide a more efficient random selection path. By default the first plural result is returned.
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".