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§
Sourcefn 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§
Sourcefn 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.
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.
Implementations on Foreign Types§
Source§impl ProxyDB for ()
impl ProxyDB for ()
type Error = OpaqueError
async fn get_proxy_if( &self, _ctx: TransportContext, _filter: ProxyFilter, _predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, _ctx: TransportContext, _filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B> ProxyDB for Either<A, B>
impl<A, B> ProxyDB for Either<A, B>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C> ProxyDB for Either3<A, B, C>
impl<A, B, C> ProxyDB for Either3<A, B, C>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D> ProxyDB for Either4<A, B, C, D>
impl<A, B, C, D> ProxyDB for Either4<A, B, C, D>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D, E> ProxyDB for Either5<A, B, C, D, E>
impl<A, B, C, D, E> ProxyDB for Either5<A, B, C, D, E>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D, E, F> ProxyDB for Either6<A, B, C, D, E, F>
impl<A, B, C, D, E, F> ProxyDB for Either6<A, B, C, D, E, F>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D, E, F, G> ProxyDB for Either7<A, B, C, D, E, F, G>
impl<A, B, C, D, E, F, G> ProxyDB for Either7<A, B, C, D, E, F, G>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D, E, F, G, H> ProxyDB for Either8<A, B, C, D, E, F, G, H>
impl<A, B, C, D, E, F, G, H> ProxyDB for Either8<A, B, C, D, E, F, G, H>
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<A, B, C, D, E, F, G, H, I> ProxyDB for Either9<A, B, C, D, E, F, G, H, I>where
A: ProxyDB<Error: Into<BoxError>>,
B: ProxyDB<Error: Into<BoxError>>,
C: ProxyDB<Error: Into<BoxError>>,
D: ProxyDB<Error: Into<BoxError>>,
E: ProxyDB<Error: Into<BoxError>>,
F: ProxyDB<Error: Into<BoxError>>,
G: ProxyDB<Error: Into<BoxError>>,
H: ProxyDB<Error: Into<BoxError>>,
I: ProxyDB<Error: Into<BoxError>>,
impl<A, B, C, D, E, F, G, H, I> ProxyDB for Either9<A, B, C, D, E, F, G, H, I>where
A: ProxyDB<Error: Into<BoxError>>,
B: ProxyDB<Error: Into<BoxError>>,
C: ProxyDB<Error: Into<BoxError>>,
D: ProxyDB<Error: Into<BoxError>>,
E: ProxyDB<Error: Into<BoxError>>,
F: ProxyDB<Error: Into<BoxError>>,
G: ProxyDB<Error: Into<BoxError>>,
H: ProxyDB<Error: Into<BoxError>>,
I: ProxyDB<Error: Into<BoxError>>,
type Error = Box<dyn Error + Sync + Send>
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<T> ProxyDB for Option<T>
impl<T> ProxyDB for Option<T>
type Error = OpaqueError
async fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> Result<Proxy, Self::Error>
async fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> Result<Proxy, Self::Error>
Source§impl<T> ProxyDB for Arc<T>where
T: ProxyDB,
impl<T> ProxyDB for Arc<T>where
T: ProxyDB,
type Error = <T as ProxyDB>::Error
fn get_proxy_if( &self, ctx: TransportContext, filter: ProxyFilter, predicate: impl ProxyQueryPredicate, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_
fn get_proxy( &self, ctx: TransportContext, filter: ProxyFilter, ) -> impl Future<Output = Result<Proxy, Self::Error>> + Send + '_
Implementors§
Source§impl ProxyDB for MemoryProxyDB
Available on crate feature memory-db
only.
impl ProxyDB for MemoryProxyDB
Available on crate feature
memory-db
only.