pub enum NameOrAddress {
Address(Address),
Name(String),
}Variants§
Implementations§
source§impl NameOrAddress
impl NameOrAddress
pub fn into_string(self) -> String
sourcepub async fn try_resolve(
&self,
ctx: &(impl ControlNodeDelegate + ?Sized)
) -> Result<Result<ResolvedAddress, DomainName>>
pub async fn try_resolve( &self, ctx: &(impl ControlNodeDelegate + ?Sized) ) -> Result<Result<ResolvedAddress, DomainName>>
Resolve this NameOrAddress.
If self is a NameOrAddress::Address, the inner Address is
returned in a ResolvedAddress without a DomainName.
Otherwise, if self is a NameOrAddress::Name, the Address is
looked up by that name in the SpacetimeDB DNS and returned in a
ResolvedAddress alongside Some DomainName.
Errors are returned if NameOrAddress::Name cannot be parsed into a
DomainName, or the DNS lookup fails.
An Ok result is itself a Result, which is Err(DomainName) if the
given NameOrAddress::Name is not registered in the SpacetimeDB DNS,
i.e. no corresponding Address exists.
sourcepub async fn resolve(
&self,
ctx: &(impl ControlNodeDelegate + ?Sized)
) -> Result<ResolvedAddress>
pub async fn resolve( &self, ctx: &(impl ControlNodeDelegate + ?Sized) ) -> Result<ResolvedAddress>
A variant of Self::try_resolve() which maps to a 400 (Bad Request)
response if self is a NameOrAddress::Name for which no
corresponding Address is found in the SpacetimeDB DNS.
Trait Implementations§
source§impl Clone for NameOrAddress
impl Clone for NameOrAddress
source§fn clone(&self) -> NameOrAddress
fn clone(&self) -> NameOrAddress
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more