pub struct QualifiedName(/* private fields */);
Expand description
A qualified name, consisting of a sequence of name segments.
A qualified name is a sequence of segments that unambiguously names an element in a set, or a family of sets, or a family of family of sets, and so on. For example, a qualified name with three segments can be constructed as
let name: QualifiedName = ["foo", "bar", "baz"].map(NameSegment::from).into();
assert_eq!(name.to_string(), "foo.bar.baz");
§Data structure
At this time, a qualified name is stored simply as a vector of name segments.
Various optimizations could be considered, such as an Rc<[NameSegment]>
or,
since qualified names tend to have only a few segments, a
SmallVec<[NameSegment; n]>
for some choice of n
. These will be considered
premature optimizations until there is good evidence in favor of them.
§Serialization
To simplify their use in JavaScript, qualified name are serialized as flat strings with segments separated by periods. Human-readable names are quoted with backticks regardless of whether they contain whitespace, which makes parsing easier. Note that the display format is different from the serialization format.
Implementations§
Source§impl QualifiedName
impl QualifiedName
Sourcepub fn single(segment: NameSegment) -> Self
pub fn single(segment: NameSegment) -> Self
Constructs a qualified name with a single segment.
Sourcepub fn segments(&self) -> impl Iterator<Item = &NameSegment>
pub fn segments(&self) -> impl Iterator<Item = &NameSegment>
Iterates over the segments of the qualified name.
Sourcepub fn only(&self) -> Option<NameSegment>
pub fn only(&self) -> Option<NameSegment>
Gets the segment from a qualified name with only one segment.
Sourcepub fn serialize_string(&self) -> String
pub fn serialize_string(&self) -> String
Serializes the qualified name into a string.
Sourcepub fn deserialize_str(input: &str) -> Result<Self, String>
pub fn deserialize_str(input: &str) -> Result<Self, String>
Deserializes a qualified name from a string.
Trait Implementations§
Source§impl Clone for QualifiedName
impl Clone for QualifiedName
Source§fn clone(&self) -> QualifiedName
fn clone(&self) -> QualifiedName
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for QualifiedName
impl Debug for QualifiedName
Source§impl<'de> Deserialize<'de> for QualifiedName
impl<'de> Deserialize<'de> for QualifiedName
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 Display for QualifiedName
impl Display for QualifiedName
Source§impl From<&str> for QualifiedName
impl From<&str> for QualifiedName
Source§impl<const N: usize> From<[NameSegment; N]> for QualifiedName
impl<const N: usize> From<[NameSegment; N]> for QualifiedName
Source§fn from(segments: [NameSegment; N]) -> Self
fn from(segments: [NameSegment; N]) -> Self
Source§impl From<QualifiedName> for JsValuewhere
QualifiedName: Serialize,
impl From<QualifiedName> for JsValuewhere
QualifiedName: Serialize,
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for ModalMor
impl From<QualifiedName> for ModalMor
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for ModalOb
impl From<QualifiedName> for ModalOb
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for ModalOp
impl From<QualifiedName> for ModalOp
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for TabMor
impl From<QualifiedName> for TabMor
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for TabEdge
impl From<QualifiedName> for TabEdge
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for TabMorType
impl From<QualifiedName> for TabMorType
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for TabOb
impl From<QualifiedName> for TabOb
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<QualifiedName> for TabObType
impl From<QualifiedName> for TabObType
Source§fn from(value: QualifiedName) -> Self
fn from(value: QualifiedName) -> Self
Source§impl From<Ustr> for QualifiedName
impl From<Ustr> for QualifiedName
Source§impl From<Uuid> for QualifiedName
impl From<Uuid> for QualifiedName
Source§impl From<Vec<NameSegment>> for QualifiedName
impl From<Vec<NameSegment>> for QualifiedName
Source§fn from(value: Vec<NameSegment>) -> Self
fn from(value: Vec<NameSegment>) -> Self
Source§impl FromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
impl FromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
Source§impl Hash for QualifiedName
impl Hash for QualifiedName
Source§impl IntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
impl IntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
Source§impl OptionFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
Source§impl OptionIntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
impl OptionIntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
Source§impl Ord for QualifiedName
impl Ord for QualifiedName
Source§fn cmp(&self, other: &QualifiedName) -> Ordering
fn cmp(&self, other: &QualifiedName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for QualifiedName
impl PartialEq for QualifiedName
Source§impl PartialOrd for QualifiedName
impl PartialOrd for QualifiedName
Source§impl RefFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
impl RefFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self
are recovered from.Source§type Anchor = SelfOwner<QualifiedName>
type Anchor = SelfOwner<QualifiedName>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl Serialize for QualifiedName
impl Serialize for QualifiedName
Source§impl Tsify for QualifiedName
impl Tsify for QualifiedName
const DECL: &'static str = "/**\n * A qualified name, consisting of a sequence of [name segments](NameSegment).\\n\\nA qualified name is a sequence of segments that unambiguously names an element\\nin a set, or a family of sets, or a family of family of sets, and so on. For\\nexample, a qualified name with three segments can be constructed as\\n\\n```\\n# use catlog::zero::qualified::*;\\nlet name: QualifiedName = [\\\"foo\\\", \\\"bar\\\", \\\"baz\\\"].map(NameSegment::from).into();\\nassert_eq!(name.to_string(), \\\"foo.bar.baz\\\");\\n```\\n\\n# Data structure\\n\\nAt this time, a qualified name is stored simply as a vector of name segments.\\nVarious optimizations could be considered, such as an `Rc<[NameSegment]>` or,\\nsince qualified names tend to have only a few segments, a\\n`SmallVec<[NameSegment; n]>` for some choice of `n`. These will be considered\\npremature optimizations until there is good evidence in favor of them.\\n\\n# Serialization\\n\\nTo simplify their use in JavaScript, qualified name are serialized as flat\\nstrings with segments separated by periods. Human-readable names are quoted with\\nbackticks regardless of whether they contain whitespace, which makes parsing\\neasier. Note that the [display](Display) format is different from the\\nserialization format.\\n \n */\nexport type QualifiedName = string;"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl VectorFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for QualifiedNamewhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
impl VectorIntoWasmAbi for QualifiedNamewhere
QualifiedName: Serialize,
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Source§impl WasmDescribeVector for QualifiedName
impl WasmDescribeVector for QualifiedName
impl Eq for QualifiedName
impl StructuralPartialEq for QualifiedName
Auto Trait Implementations§
impl Freeze for QualifiedName
impl RefUnwindSafe for QualifiedName
impl Send for QualifiedName
impl Sync for QualifiedName
impl Unpin for QualifiedName
impl UnwindSafe for QualifiedName
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.