pub struct QName { /* private fields */ }Expand description
Qualified plugin item name — namespace.local.
QName is the address every plugin-registered extension is looked up by.
The namespace is the registering plugin’s id; the local is the per-plugin
item name. Built-ins use the reserved namespace QName::BUILTIN_NS.
§Examples
use uni_plugin::QName;
let q = QName::parse("ai.dragonscale.geo.haversine").unwrap();
assert_eq!(q.namespace(), "ai.dragonscale.geo");
assert_eq!(q.local(), "haversine");§Errors
QName::parse returns PluginError::InvalidQName if the input does
not contain at least one . separating namespace from local, or if either
side is empty.
Implementations§
Source§impl QName
impl QName
Sourcepub const BUILTIN_NS: &'static str = "builtin"
pub const BUILTIN_NS: &'static str = "builtin"
Reserved namespace for uni-db built-in extensions.
Built-ins registered by uni-plugin-builtin use this namespace so
they are distinguishable from third-party plugins at the registry
level. The user-facing Cypher / Locy syntax does not require the
namespace prefix for built-ins — RETURN toUpper(s) resolves to
builtin.toUpper through Cypher’s case-insensitive matching.
Sourcepub fn new(namespace: impl Into<SmolStr>, local: impl Into<SmolStr>) -> Self
pub fn new(namespace: impl Into<SmolStr>, local: impl Into<SmolStr>) -> Self
Construct a QName from already-validated parts.
§Panics
Panics if namespace or local is empty, since this is a programming
error rather than a fallible parse — use QName::parse to validate
untrusted input.
Sourcepub fn builtin(local: impl Into<SmolStr>) -> Self
pub fn builtin(local: impl Into<SmolStr>) -> Self
Construct a QName in the QName::BUILTIN_NS namespace.
Shorthand for built-in registrations.
§Examples
use uni_plugin::QName;
let q = QName::builtin("MIN");
assert_eq!(q.namespace(), "builtin");
assert_eq!(q.local(), "MIN");Sourcepub fn parse(s: impl AsRef<str>) -> Result<Self, PluginError>
pub fn parse(s: impl AsRef<str>) -> Result<Self, PluginError>
Parse a fully-qualified name like "ai.dragonscale.geo.haversine".
The last segment (after the final .) is taken as the local name; the
preceding segments are joined back as the namespace. A namespace with
no . (e.g. "builtin.MIN") is also accepted.
§Errors
Returns PluginError::InvalidQName if the input lacks a ., or if
either side of the final . is empty.
Sourcepub fn is_builtin(&self) -> bool
pub fn is_builtin(&self) -> bool
Returns true if this name is in the reserved built-in namespace.
Sourcepub fn matches_cypher(&self, other: &Self) -> bool
pub fn matches_cypher(&self, other: &Self) -> bool
Cypher-style case-insensitive equality.
Cypher function-call sites compare names case-insensitively
(toUpper and TOUPPER resolve identically). Locy uses
PartialEq (case-sensitive) directly.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for QName
impl<'de> Deserialize<'de> for QName
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>,
impl Eq for QName
impl StructuralPartialEq for QName
Auto Trait Implementations§
impl Freeze for QName
impl RefUnwindSafe for QName
impl Send for QName
impl Sync for QName
impl Unpin for QName
impl UnsafeUnpin for QName
impl UnwindSafe for QName
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> 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 more