use std::future::Future;
use crate::Address;
mod impls;
use cheap_clone::CheapClone;
pub use impls::*;
#[cfg(feature = "agnostic")]
pub use agnostic::{Runtime, RuntimeLite};
#[cfg(not(feature = "agnostic"))]
pub trait AddressResolver: Send + Sync + 'static {
type Address: Address;
type ResolvedAddress: CheapClone
+ core::hash::Hash
+ Eq
+ core::fmt::Debug
+ core::fmt::Display
+ Send
+ Sync
+ 'static;
type Error: core::error::Error + Send + Sync + 'static;
type Options: Send + Sync + 'static;
fn new(options: Self::Options) -> impl Future<Output = Result<Self, Self::Error>> + Send
where
Self: Sized;
fn resolve(
&self,
address: &Self::Address,
) -> impl Future<Output = Result<Self::ResolvedAddress, Self::Error>> + Send;
}
#[cfg(feature = "agnostic")]
pub trait AddressResolver: Send + Sync + 'static {
type Address: Address;
type ResolvedAddress: CheapClone
+ core::hash::Hash
+ Eq
+ Ord
+ core::fmt::Debug
+ core::fmt::Display
+ Send
+ Sync
+ 'static;
type Error: core::error::Error + Send + Sync + 'static;
type Runtime: agnostic::RuntimeLite;
type Options: Send + Sync + 'static;
fn new(options: Self::Options) -> impl Future<Output = Result<Self, Self::Error>> + Send
where
Self: Sized;
fn resolve(
&self,
address: &Self::Address,
) -> impl Future<Output = Result<Self::ResolvedAddress, Self::Error>> + Send;
}