ResolvableExt

Trait ResolvableExt 

Source
pub trait ResolvableExt<I>
where I: ResolvableItem,
{ // Required methods fn state(&self) -> ResolvableState; fn resolve_next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Option<I>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn is_empty(&self) -> bool { ... } fn is_unset(&self) -> bool { ... } fn is_empty_or_unset(&self) -> bool { ... } }
Expand description

ResolvableExt is a trait that specifies which methods a resolvable type should implement. The main things are the ResolvableExt::state which specifies the state (and based on that Lookup and other types take decisions) and ResolvableExt::resolve_next which is an async method that returns the next element (which implements the ResolvableItem) of the resolvable type or none if there is nothing.

Note that almost all resolvable types that can host other resolvable types internally and the whole thing becomes a nested tree kinda. But it’s an important structure to resemble the lazyness async nature of resolving the next (ip, port, transport) tuple of the DNS results.

Required Methods§

Source

fn state(&self) -> ResolvableState

Returns the state of the resolvable type

Source

fn resolve_next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Option<I>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

This method returns the next item from the resolvable type Note that a resolvable type might host other resolvable types internally, and in any case one or more DNS queries might be needed to get the next item. If no item is found, None is returned.

[async_trait] makes this method look a bit more complex that what it actually is, (it’s just an async fn resolve_next(&mut self) -> Option<I>).

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn is_unset(&self) -> bool

Source

fn is_empty_or_unset(&self) -> bool

Implementations on Foreign Types§

Source§

impl<I, T> ResolvableExt<T> for VecDeque<I>
where I: ResolvableExt<T> + Send, T: ResolvableItem,

Source§

fn state(&self) -> ResolvableState

Source§

fn resolve_next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Option<T>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<T, I> ResolvableExt<I> for Option<T>
where T: ResolvableExt<I> + Send, I: ResolvableItem,

Source§

fn state(&self) -> ResolvableState

Source§

fn resolve_next<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Option<I>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§