pub enum SimpleTerm<'a> {
Iri(IriRef<MownStr<'a>>),
BlankNode(BnodeId<MownStr<'a>>),
LiteralDatatype(MownStr<'a>, IriRef<MownStr<'a>>),
LiteralLanguage(MownStr<'a>, LanguageTag<MownStr<'a>>),
Triple(Box<[Self; 3]>),
Variable(VarName<MownStr<'a>>),
}
Expand description
A straighforward implementation of Term
as an enum.
Variants§
Iri(IriRef<MownStr<'a>>)
An RDF IRI
BlankNode(BnodeId<MownStr<'a>>)
An RDF blank node
LiteralDatatype(MownStr<'a>, IriRef<MownStr<'a>>)
An RDF literal
LiteralLanguage(MownStr<'a>, LanguageTag<MownStr<'a>>)
An RDF language-tagged string
Triple(Box<[Self; 3]>)
An RDF-star quoted triple
Variable(VarName<MownStr<'a>>)
A SPARQL or Notation3 variable
Implementations§
Source§impl<'a> SimpleTerm<'a>
impl<'a> SimpleTerm<'a>
Sourcepub fn from_term_ref<T>(term: &'a T) -> Self
pub fn from_term_ref<T>(term: &'a T) -> Self
Build a SimpleTerm
that borrows as much as possible from the original term
.
NB: depending on the implementation of term
,
some data might still be allocated.
Sourcepub fn from_triple<T: Triple>(triple: T) -> Self
pub fn from_triple<T: Triple>(triple: T) -> Self
Build a SimpleTerm
of kind Triple
from any triple.
Trait Implementations§
Source§impl<'a> Clone for SimpleTerm<'a>
impl<'a> Clone for SimpleTerm<'a>
Source§fn clone(&self) -> SimpleTerm<'a>
fn clone(&self) -> SimpleTerm<'a>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for SimpleTerm<'a>
impl<'a> Debug for SimpleTerm<'a>
Source§impl FromTerm for SimpleTerm<'static>
impl FromTerm for SimpleTerm<'static>
Source§impl Hash for SimpleTerm<'_>
impl Hash for SimpleTerm<'_>
Source§impl Ord for SimpleTerm<'_>
impl Ord for SimpleTerm<'_>
Source§impl<T: Term> PartialEq<T> for SimpleTerm<'_>
impl<T: Term> PartialEq<T> for SimpleTerm<'_>
Source§impl<T: Term> PartialOrd<T> for SimpleTerm<'_>
impl<T: Term> PartialOrd<T> for SimpleTerm<'_>
Source§impl<'a> Term for SimpleTerm<'a>
impl<'a> Term for SimpleTerm<'a>
Source§type BorrowTerm<'x> = &'x SimpleTerm<'a>
where
'a: 'x
type BorrowTerm<'x> = &'x SimpleTerm<'a> where 'a: 'x
A type of
Term
that can be borrowed from this type
(i.e. that can be obtained from a simple reference to this type).
It is used in particular for accessing constituents of quoted tripes (Term::triple
)
or for sharing this term with a function that expects T: Term
(rather than &T
)
using Term::borrow_term
. Read moreSource§fn bnode_id(&self) -> Option<BnodeId<MownStr<'_>>>
fn bnode_id(&self) -> Option<BnodeId<MownStr<'_>>>
If
kind
returns TermKind::BlankNode
,
return the locally unique label of this blank node.
Otherwise return None
. Read moreSource§fn lexical_form(&self) -> Option<MownStr<'_>>
fn lexical_form(&self) -> Option<MownStr<'_>>
If
kind
returns TermKind::Literal
,
return the lexical form of this literal.
Otherwise return None
. Read moreSource§fn datatype(&self) -> Option<IriRef<MownStr<'_>>>
fn datatype(&self) -> Option<IriRef<MownStr<'_>>>
If
kind
returns TermKind::Literal
,
return the datatype IRI of this literal.
Otherwise return None
. Read moreSource§fn language_tag(&self) -> Option<LanguageTag<MownStr<'_>>>
fn language_tag(&self) -> Option<LanguageTag<MownStr<'_>>>
If
kind
returns TermKind::Literal
,
and if this literal is a language-tagged string,
return its language tag.
Otherwise return None
. Read moreSource§fn variable(&self) -> Option<VarName<MownStr<'_>>>
fn variable(&self) -> Option<VarName<MownStr<'_>>>
If
kind
returns TermKind::Variable
,
return the name of this variable.
Otherwise return None
. Read moreSource§fn to_triple(self) -> Option<[Self; 3]>
fn to_triple(self) -> Option<[Self; 3]>
If
kind
returns TermKind::Triple
,
return this triple, consuming this term.
Otherwise return None
. Read moreSource§fn borrow_term(&self) -> Self::BorrowTerm<'_>
fn borrow_term(&self) -> Self::BorrowTerm<'_>
Source§fn is_blank_node(&self) -> bool
fn is_blank_node(&self) -> bool
Source§fn is_literal(&self) -> bool
fn is_literal(&self) -> bool
Source§fn is_variable(&self) -> bool
fn is_variable(&self) -> bool
Source§fn constituents<'s>(
&'s self,
) -> Box<dyn Iterator<Item = Self::BorrowTerm<'s>> + 's>
fn constituents<'s>( &'s self, ) -> Box<dyn Iterator<Item = Self::BorrowTerm<'s>> + 's>
Iter over all the constituents of this term. Read more
Source§fn to_constituents<'a>(self) -> Box<dyn Iterator<Item = Self> + 'a>where
Self: Clone + 'a,
fn to_constituents<'a>(self) -> Box<dyn Iterator<Item = Self> + 'a>where
Self: Clone + 'a,
Iter over all the constiutents of this term, consuming it. Read more
Source§fn eq<T: Term>(&self, other: T) -> bool
fn eq<T: Term>(&self, other: T) -> bool
Check whether
self
and other
represent the same RDF term.Source§fn hash<H: Hasher>(&self, state: &mut H)
fn hash<H: Hasher>(&self, state: &mut H)
Compute an implementation-independant hash of this RDF term.
Source§fn into_term<T: FromTerm>(self) -> Twhere
Self: Sized,
fn into_term<T: FromTerm>(self) -> Twhere
Self: Sized,
Convert this term in another type. Read more
Source§fn try_into_term<T: TryFromTerm>(self) -> Result<T, T::Error>where
Self: Sized,
fn try_into_term<T: TryFromTerm>(self) -> Result<T, T::Error>where
Self: Sized,
Try to convert this term into another type. Read more
Source§fn as_simple(&self) -> SimpleTerm<'_>
fn as_simple(&self) -> SimpleTerm<'_>
Copies this term into a
SimpleTerm
,
borrowing as much as possible from self
(calling SimpleTerm::from_term_ref
).Source§impl TryFromTerm for SimpleTerm<'static>
impl TryFromTerm for SimpleTerm<'static>
Source§type Error = Infallible
type Error = Infallible
The error type produced when failing to copy a given term
impl Eq for SimpleTerm<'_>
Auto Trait Implementations§
impl<'a> Freeze for SimpleTerm<'a>
impl<'a> RefUnwindSafe for SimpleTerm<'a>
impl<'a> Send for SimpleTerm<'a>
impl<'a> Sync for SimpleTerm<'a>
impl<'a> Unpin for SimpleTerm<'a>
impl<'a> UnwindSafe for SimpleTerm<'a>
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
Mutably borrows from an owned value. Read more