pub struct Key(/* private fields */);Expand description
Context key.
Stores the canonical &'static str returned by the process-wide interner
directly, so Key::as_str is a single load and equality on equal logical
strings short-circuits via pointer equality (the interner guarantees a
unique allocation per interned string).
Interned strings are never freed: memory usage grows with the number of
distinct keys the process parses. See the crate::intern module
documentation for the implications when parsing untrusted input.
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§
impl Copy for Key
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<Key, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Key, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for Key
Source§impl From<CompactString> for Key
impl From<CompactString> for Key
Source§fn from(k: CompactString) -> Key
fn from(k: CompactString) -> 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<(), Error>
fn fmt_with( &self, f: &mut Formatter<'_>, _options: &Options, _indent: usize, ) -> Result<(), Error>
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>
Source§impl Serialize for Key
Available on crate feature serde only.
impl Serialize for Key
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl TryFromJson for Key
impl TryFromJson for Key
Source§type Error = InvalidContext
type Error = InvalidContext
Self.Source§fn try_from_json(value: &Value) -> Result<Key, <Key as TryFromJson>::Error>
fn try_from_json(value: &Value) -> Result<Key, <Key as TryFromJson>::Error>
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<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, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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