pub trait HostResolveAddressStream: Sized + Send {
// Required methods
fn resolve_next_address(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> impl Future<Output = Result<Result<Option<IpAddress>, ErrorCode>>> + Send;
fn subscribe(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> impl Future<Output = Result<Resource<Pollable>>> + Send;
fn drop(
&mut self,
rep: Resource<ResolveAddressStream>,
) -> impl Future<Output = Result<()>> + Send;
}
Required Methods§
Sourcefn resolve_next_address(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> impl Future<Output = Result<Result<Option<IpAddress>, ErrorCode>>> + Send
fn resolve_next_address( &mut self, self_: Resource<ResolveAddressStream>, ) -> impl Future<Output = Result<Result<Option<IpAddress>, ErrorCode>>> + Send
Returns the next address from the resolver.
This function should be called multiple times. On each call, it will
return the next address in connection order preference. If all
addresses have been exhausted, this function returns none
.
This function never returns IPv4-mapped IPv6 addresses.
§Typical errors
name-unresolvable
: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)temporary-resolver-failure
: A temporary failure in name resolution occurred. (EAI_AGAIN)permanent-resolver-failure
: A permanent failure in name resolution occurred. (EAI_FAIL)would-block
: A result is not available yet. (EWOULDBLOCK, EAGAIN)
Sourcefn subscribe(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> impl Future<Output = Result<Resource<Pollable>>> + Send
fn subscribe( &mut self, self_: Resource<ResolveAddressStream>, ) -> impl Future<Output = Result<Resource<Pollable>>> + Send
Create a pollable
which will resolve once the stream is ready for I/O.
Note: this function is here for WASI Preview2 only.
It’s planned to be removed when future
is natively supported in Preview3.
fn drop( &mut self, rep: Resource<ResolveAddressStream>, ) -> impl Future<Output = Result<()>> + Send
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<_T: HostResolveAddressStream + ?Sized + Send> HostResolveAddressStream for &mut _T
impl<_T: HostResolveAddressStream + ?Sized + Send> HostResolveAddressStream for &mut _T
Source§async fn resolve_next_address(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> Result<Result<Option<IpAddress>, ErrorCode>>
async fn resolve_next_address( &mut self, self_: Resource<ResolveAddressStream>, ) -> Result<Result<Option<IpAddress>, ErrorCode>>
Returns the next address from the resolver.
This function should be called multiple times. On each call, it will
return the next address in connection order preference. If all
addresses have been exhausted, this function returns none
.
This function never returns IPv4-mapped IPv6 addresses.
§Typical errors
name-unresolvable
: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY)temporary-resolver-failure
: A temporary failure in name resolution occurred. (EAI_AGAIN)permanent-resolver-failure
: A permanent failure in name resolution occurred. (EAI_FAIL)would-block
: A result is not available yet. (EWOULDBLOCK, EAGAIN)
Source§async fn subscribe(
&mut self,
self_: Resource<ResolveAddressStream>,
) -> Result<Resource<Pollable>>
async fn subscribe( &mut self, self_: Resource<ResolveAddressStream>, ) -> Result<Resource<Pollable>>
Create a pollable
which will resolve once the stream is ready for I/O.
Note: this function is here for WASI Preview2 only.
It’s planned to be removed when future
is natively supported in Preview3.