QualifiedName

Struct QualifiedName 

Source
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

Source

pub fn single(segment: NameSegment) -> Self

Constructs a qualified name with a single segment.

Source

pub fn as_slice(&self) -> &[NameSegment]

Extracts a slice containing the name segments.

Source

pub fn segments(&self) -> impl Iterator<Item = &NameSegment>

Iterates over the segments of the qualified name.

Source

pub fn only(&self) -> Option<NameSegment>

Gets the segment from a qualified name with only one segment.

Source

pub fn snoc(&self, segment: NameSegment) -> Self

Add another segment onto the end.

Source

pub fn serialize_string(&self) -> String

Serializes the qualified name into a string.

Source

pub fn deserialize_str(input: &str) -> Result<Self, String>

Deserializes a qualified name from a string.

Trait Implementations§

Source§

impl Clone for QualifiedName

Source§

fn clone(&self) -> QualifiedName

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QualifiedName

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for QualifiedName

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for QualifiedName

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&str> for QualifiedName

Source§

fn from(name: &str) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[&str; N]> for QualifiedName

Source§

fn from(segments: [&str; N]) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[NameSegment; N]> for QualifiedName

Source§

fn from(segments: [NameSegment; N]) -> Self

Converts to this type from the input type.
Source§

impl<const N: usize> From<[Uuid; N]> for QualifiedName

Source§

fn from(segments: [Uuid; N]) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for JsValue

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for ModalMor

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for ModalOb

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for ModalOp

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for ObType

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for TabMor

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for TabEdge

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for TabMorType

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for TabOb

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<QualifiedName> for TabObType

Source§

fn from(value: QualifiedName) -> Self

Converts to this type from the input type.
Source§

impl From<Ustr> for QualifiedName

Source§

fn from(name: Ustr) -> Self

Converts to this type from the input type.
Source§

impl From<Uuid> for QualifiedName

Source§

fn from(id: Uuid) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<NameSegment>> for QualifiedName

Source§

fn from(value: Vec<NameSegment>) -> Self

Converts to this type from the input type.
Source§

impl FromWasmAbi for QualifiedName
where Self: DeserializeOwned,

Source§

type Abi = <JsType as FromWasmAbi>::Abi

The Wasm ABI type that this converts from when coming back out from the ABI boundary.
Source§

unsafe fn from_abi(js: Self::Abi) -> Self

Recover a Self from Self::Abi. Read more
Source§

impl Hash for QualifiedName

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Iden for QualifiedName

Source§

fn unquoted(&self, s: &mut dyn Write)

Write a raw identifier string without quotes. Read more
§

fn prepare(&self, s: &mut dyn Write, q: Quote)

§

fn quoted(&self, q: Quote) -> String

§

fn to_string(&self) -> String

A shortcut for writing an [unquoted][Iden::unquoted] identifier into a String. Read more
Source§

impl IntoWasmAbi for &QualifiedName

Source§

type Abi = <JsType as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl IntoWasmAbi for QualifiedName

Source§

type Abi = <JsType as IntoWasmAbi>::Abi

The Wasm ABI type that this converts into when crossing the ABI boundary.
Source§

fn into_abi(self) -> Self::Abi

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary.
Source§

impl OptionFromWasmAbi for QualifiedName
where Self: DeserializeOwned,

Source§

fn is_none(js: &Self::Abi) -> bool

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi.
Source§

impl OptionIntoWasmAbi for QualifiedName

Source§

fn none() -> Self::Abi

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more
Source§

impl Ord for QualifiedName

Source§

fn cmp(&self, other: &QualifiedName) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for QualifiedName

Source§

fn eq(&self, other: &QualifiedName) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for QualifiedName

Source§

fn partial_cmp(&self, other: &QualifiedName) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl RefFromWasmAbi for QualifiedName
where Self: DeserializeOwned,

Source§

type Abi = <JsType as RefFromWasmAbi>::Abi

The Wasm ABI type references to Self are recovered from.
Source§

type Anchor = SelfOwner<QualifiedName>

The type that holds the reference to 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§

unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor

Recover a Self::Anchor from Self::Abi. Read more
Source§

impl Serialize for QualifiedName

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToDoc for QualifiedName

Source§

fn to_doc<'a>(&self) -> D<'a>

Pretty prints the object, returning a doc.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime ObOp> for &'__deriveMoreLifetime QualifiedName

Source§

type Error = TryIntoError<&'__deriveMoreLifetime ObOp>

The type returned in the event of a conversion error.
Source§

fn try_from( value: &'__deriveMoreLifetime ObOp, ) -> Result<Self, TryIntoError<&'__deriveMoreLifetime ObOp>>

Performs the conversion.
Source§

impl<'__deriveMoreLifetime> TryFrom<&'__deriveMoreLifetime ObType> for &'__deriveMoreLifetime QualifiedName

Source§

type Error = TryIntoError<&'__deriveMoreLifetime ObType>

The type returned in the event of a conversion error.
Source§

fn try_from( value: &'__deriveMoreLifetime ObType, ) -> Result<Self, TryIntoError<&'__deriveMoreLifetime ObType>>

Performs the conversion.
Source§

impl TryFrom<ObOp> for QualifiedName

Source§

type Error = TryIntoError<ObOp>

The type returned in the event of a conversion error.
Source§

fn try_from(value: ObOp) -> Result<Self, TryIntoError<ObOp>>

Performs the conversion.
Source§

impl TryFrom<ObType> for QualifiedName

Source§

type Error = TryIntoError<ObType>

The type returned in the event of a conversion error.
Source§

fn try_from(value: ObType) -> Result<Self, TryIntoError<ObType>>

Performs the conversion.
Source§

impl Tsify for QualifiedName

Source§

const DECL: &'static str = "/**\n * A qualified name, consisting of a sequence of [name segments](NameSegment).\n *\n * A qualified name is a sequence of segments that unambiguously names an element\n * in a set, or a family of sets, or a family of family of sets, and so on. For\n * example, a qualified name with three segments can be constructed as:\n *\n * ```\n * # use catlog::zero::qualified::*;\n * let name: QualifiedName = [\\\"foo\\\", \\\"bar\\\", \\\"baz\\\"].map(NameSegment::from).into();\n * assert_eq!(name.to_string(), \\\"foo.bar.baz\\\");\n * ```\n *\n * # Data structure\n *\n * At this time, a qualified name is stored simply as a vector of name segments.\n * Various optimizations could be considered, such as an `Rc<[NameSegment]>` or,\n * since qualified names tend to have only a few segments, a\n * `SmallVec<[NameSegment; n]>` for some choice of `n`. These will be considered\n * premature optimizations until there is good evidence in favor of them.\n *\n * # Serialization\n *\n * To simplify their use in JavaScript, qualified name are serialized as flat\n * strings with segments separated by periods. Human-readable names are quoted with\n * backticks regardless of whether they contain whitespace, which makes parsing\n * easier. Note that the [display](Display) format is different from the\n * serialization format.\n */\nexport type QualifiedName = string;"

Source§

const SERIALIZATION_CONFIG: SerializationConfig

Source§

type JsType = JsType

§

fn into_js(&self) -> Result<Self::JsType, Error>
where Self: Serialize,

§

fn from_js<T>(js: T) -> Result<Self, Error>
where T: Into<JsValue>, Self: DeserializeOwned,

Source§

impl VectorFromWasmAbi for QualifiedName
where Self: DeserializeOwned,

Source§

type Abi = <JsType as VectorFromWasmAbi>::Abi

Source§

unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>

Source§

impl VectorIntoWasmAbi for QualifiedName

Source§

type Abi = <JsType as VectorIntoWasmAbi>::Abi

Source§

fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi

Source§

impl WasmDescribe for QualifiedName

Source§

impl WasmDescribeVector for QualifiedName

Source§

impl Eq for QualifiedName

Source§

impl StructuralPartialEq for QualifiedName

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<I> IdenList for I
where I: IntoIden,

§

type IntoIter = Once<SeaRc<dyn Iden>>

§

fn into_iter(self) -> <I as IdenList>::IntoIter

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoColumnRef for T
where T: 'static + IntoIden,

§

fn into_column_ref(self) -> ColumnRef

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<T> IntoIden for T
where T: 'static + Iden,

§

fn into_iden(self) -> SeaRc<dyn Iden>

§

impl<I> IntoIndexColumn for I
where I: IntoIden,

§

fn into_index_column(self) -> IndexColumn

§

impl<T> IntoTableRef for T
where T: 'static + IntoIden,

§

fn into_table_ref(self) -> TableRef

§

impl<I> IntoTypeRef for I
where I: IntoIden,

§

fn into_type_ref(self) -> TypeRef

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ReturnWasmAbi for T
where T: IntoWasmAbi,

Source§

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi
Source§

fn return_abi(self) -> <T as ReturnWasmAbi>::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<T> UserDefinedCommandOutput for T
where T: Debug + Display + Send + Sync,