pub trait Host: HostResolveAddressStream + Sized {
// Required method
fn resolve_addresses(
&mut self,
network: Resource<Network>,
name: String,
) -> Result<Resource<ResolveAddressStream>, SocketError>;
}
Required Methods§
Sourcefn resolve_addresses(
&mut self,
network: Resource<Network>,
name: String,
) -> Result<Resource<ResolveAddressStream>, SocketError>
fn resolve_addresses( &mut self, network: Resource<Network>, name: String, ) -> Result<Resource<ResolveAddressStream>, SocketError>
Resolve an internet host name to a list of IP addresses.
Unicode domain names are automatically converted to ASCII using IDNA encoding. If the input is an IP address string, the address is parsed and returned as-is without making any external requests.
See the wasi-socket proposal README.md for a comparison with getaddrinfo.
This function never blocks. It either immediately fails or immediately
returns successfully with a resolve-address-stream
that can be used
to (asynchronously) fetch the results.
§Typical errors
invalid-argument
:name
is a syntactically invalid domain name or IP address.
§References:
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: Host + ?Sized> Host for &mut _T
impl<_T: Host + ?Sized> Host for &mut _T
Source§fn resolve_addresses(
&mut self,
network: Resource<Network>,
name: String,
) -> Result<Resource<ResolveAddressStream>, SocketError>
fn resolve_addresses( &mut self, network: Resource<Network>, name: String, ) -> Result<Resource<ResolveAddressStream>, SocketError>
Resolve an internet host name to a list of IP addresses.
Unicode domain names are automatically converted to ASCII using IDNA encoding. If the input is an IP address string, the address is parsed and returned as-is without making any external requests.
See the wasi-socket proposal README.md for a comparison with getaddrinfo.
This function never blocks. It either immediately fails or immediately
returns successfully with a resolve-address-stream
that can be used
to (asynchronously) fetch the results.
§Typical errors
invalid-argument
:name
is a syntactically invalid domain name or IP address.