SrvResolver

Trait SrvResolver 

Source
pub trait SrvResolver: Send + Sync {
    type Record: SrvRecord;
    type Error: Error + 'static;

    // Required method
    fn get_srv_records_unordered<'life0, 'life1, 'async_trait>(
        &'life0 self,
        srv: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Self::Record>, Instant), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_srv_records<'life0, 'life1, 'async_trait>(
        &'life0 self,
        srv: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Self::Record>, Instant), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn order_srv_records(records: &mut [Self::Record], rng: impl Rng) { ... }
}
Expand description

Represents the ability to act as a SRV resolver.

Required Associated Types§

Source

type Record: SrvRecord

SRV record representation produced by the resolver.

Source

type Error: Error + 'static

Errors encountered during SRV resolution.

Required Methods§

Source

fn get_srv_records_unordered<'life0, 'life1, 'async_trait>( &'life0 self, srv: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Self::Record>, Instant), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the records corresponding to a srv name without sorting by priority or shuffling based on weight, returning them along with the time they’re valid until.

Provided Methods§

Source

fn get_srv_records<'life0, 'life1, 'async_trait>( &'life0 self, srv: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Self::Record>, Instant), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the records corresponding to a srv name, sorting by priority and shuffling based on weight, returning them along with the time they’re valid until.

Source

fn order_srv_records(records: &mut [Self::Record], rng: impl Rng)

Sorts SRV records by priority and weight per RFC 2782.

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<C, P> SrvResolver for AsyncResolver<C, P>
where C: DnsHandle, P: ConnectionProvider<Conn = C>,

Source§

type Record = SRV

Source§

type Error = ResolveError

Source§

fn get_srv_records_unordered<'life0, 'life1, 'async_trait>( &'life0 self, srv: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Self::Record>, Instant), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§