Struct spacetimedb_lib::name::DomainName
source · pub struct DomainName { /* private fields */ }Expand description
A DomainName is the name of a database.
A database name is usually in one of the two following forms:
my_database_name
or
my_domain/mypath
You can also have as many path segments as you want (as long as it’s less than 256):
my_domain/a/b/c/d
Database names must NOT end or start in a slash and cannot have 2 slashes in a row. These are all invalid:
my_domain/a//c/d /my_domain my_domain/
Each segment in a database name can contain any UTF-8 character, except for whitespace and ‘/’. The maximum segment length is 64 characters.
The first path segment is also referred to as the “top-level domain”, or
Tld. The concatenation of all segments after the first ‘/’ is also
referred as the “subdomain”.
Note that PartialEq compares the exact string representation of a
DomainName, as one would expect, but the SpacetimeDB registry compares
the lowercase representation of it.
To construct a valid DomainName, use parse_domain_name or the
FromStr impl.
Implementations§
source§impl DomainName
impl DomainName
sourcepub fn sub_domain(&self) -> Option<&str>
pub fn sub_domain(&self) -> Option<&str>
Get the subdomain, if any.
sourcepub fn to_lowercase(&self) -> String
pub fn to_lowercase(&self) -> String
Render the name as a lower-case, ‘/’-separated string, suitable for use as a unique constrained field in a database.
Trait Implementations§
source§impl AsRef<str> for DomainName
impl AsRef<str> for DomainName
source§impl Clone for DomainName
impl Clone for DomainName
source§fn clone(&self) -> DomainName
fn clone(&self) -> DomainName
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for DomainName
impl Debug for DomainName
source§impl<'de> Deserialize<'de> for DomainName
impl<'de> Deserialize<'de> for DomainName
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
source§impl<'de> Deserialize<'de> for DomainName
impl<'de> Deserialize<'de> for DomainName
source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
deserializer.source§impl Display for DomainName
impl Display for DomainName
source§impl From<DomainName> for Tld
impl From<DomainName> for Tld
source§fn from(value: DomainName) -> Self
fn from(value: DomainName) -> Self
source§impl From<Tld> for DomainName
impl From<Tld> for DomainName
source§impl FromStr for DomainName
impl FromStr for DomainName
source§impl PartialEq for DomainName
impl PartialEq for DomainName
source§fn eq(&self, other: &DomainName) -> bool
fn eq(&self, other: &DomainName) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for DomainName
impl Serialize for DomainName
source§impl Serialize for DomainName
impl Serialize for DomainName
source§impl SpacetimeType for DomainName
impl SpacetimeType for DomainName
source§fn make_type<S: TypespaceBuilder>(_ts: &mut S) -> AlgebraicType
fn make_type<S: TypespaceBuilder>(_ts: &mut S) -> AlgebraicType
AlgebraicType representing the type for Self in SATS
and in the typing context in typespace.impl Eq for DomainName
impl StructuralEq for DomainName
impl StructuralPartialEq for DomainName
Auto Trait Implementations§
impl RefUnwindSafe for DomainName
impl Send for DomainName
impl Sync for DomainName
impl Unpin for DomainName
impl UnwindSafe for DomainName
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Satn for Twhere
T: Serialize + ?Sized,
impl<T> Satn for Twhere T: Serialize + ?Sized,
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f.source§fn fmt_psql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn fmt_psql(&self, f: &mut Formatter<'_>) -> Result<(), Error>
f.source§fn to_satn(&self) -> String
fn to_satn(&self) -> String
String.source§fn to_satn_pretty(&self) -> String
fn to_satn_pretty(&self) -> String
String.