pub struct Key(/* private fields */);Expand description
Context key.
A key of up to 23 bytes is stored inline, so creating, cloning and dropping it allocates nothing and touches no shared counter; nearly every term of a real context is that short. A longer key is shared behind a reference count.
A key owns its string and frees it when dropped, so the memory a process spends on keys is bounded by the contexts it keeps.
Equality, ordering and hashing are those of the string, so a map keyed by
Key can be searched with a &str.
Implementations§
Source§impl Key
impl Key
Sourcepub fn as_iri(&self) -> Option<Iri<&str>>
pub fn as_iri(&self) -> Option<Iri<&str>>
Parses this key as an IRI, returning None if it is not one.
Sourcepub fn as_compact_iri(&self) -> Option<&CompactIri>
pub fn as_compact_iri(&self) -> Option<&CompactIri>
Parses this key as a compact IRI, returning None if it is not one.
Sourcepub fn as_blank_id(&self) -> Option<&BlankId>
pub fn as_blank_id(&self) -> Option<&BlankId>
Parses this key as a blank node identifier, returning None if it is
not one.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Copies this key into a newly allocated String.
Sourcepub fn is_keyword_like(&self) -> bool
pub fn is_keyword_like(&self) -> bool
Checks whether this key is keyword-like: an @ followed by ASCII
letters. See crate::is_keyword_like.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Key
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Key
serde only.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 Key
Source§impl<'a> From<&'a Key> for KeyOrKeywordRef<'a>
impl<'a> From<&'a Key> for KeyOrKeywordRef<'a>
Source§impl From<CompactString> for Key
impl From<CompactString> for Key
Source§impl Ord for Key
impl Ord for Key
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Key
impl PartialOrd for Key
Source§impl PrecomputeSize for Key
impl PrecomputeSize for Key
Source§impl Print for Key
impl Print for Key
Source§fn fmt_with(
&self,
f: &mut Formatter<'_>,
_options: &Options,
_indent: usize,
) -> Result
fn fmt_with( &self, f: &mut Formatter<'_>, _options: &Options, _indent: usize, ) -> Result
f with the given options, starting at the given
indentation level. Read moreSource§fn pretty_print(&self) -> Printed<'_, Self>
fn pretty_print(&self) -> Printed<'_, Self>
Options::pretty options.Source§fn compact_print(&self) -> Printed<'_, Self>
fn compact_print(&self) -> Printed<'_, Self>
Options::compact options.Source§fn inline_print(&self) -> Printed<'_, Self>
fn inline_print(&self) -> Printed<'_, Self>
Options::inline options.Source§fn print_with(&self, options: Options) -> Printed<'_, Self>
fn print_with(&self, options: Options) -> Printed<'_, Self>
impl StructuralPartialEq for Key
Source§impl TryFromJson for Key
impl TryFromJson for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Unordered reference.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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self is equivalent to key.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<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more