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§
Sourcefn state(&self) -> ResolvableState
fn state(&self) -> ResolvableState
Returns the state of the resolvable type
Sourcefn 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,
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>).