pub struct Quad<S: IsSubject = Id, P: IsPredicate = IriBuf, O: IsObject = LocalTerm, G: IsGraph = Id>(pub S, pub P, pub O, pub Option<G>);Expand description
RDF quad.
Position bounds enforce the RDF 1.1 / 1.2 abstract syntax: subjects must
be IRIs or blank nodes, predicates must be IRIs, objects may be any term
(including, in RDF 1.2, a triple term via
LocalTerm::Triple), graph names must be IRIs
or blank nodes. For generalized RDF (RDF 1.1 §A / RDF 1.2 §A.1) use
GeneralizedQuad.
Tuple Fields§
§0: S§1: P§2: O§3: Option<G>Implementations§
Source§impl Quad
impl Quad
pub fn as_lexical_quad_ref(&self) -> LexicalQuadRef<'_>
Source§impl Quad<IdRef<'_>, Iri<&str>, LocalTermRef<'_>, IdRef<'_>>
impl Quad<IdRef<'_>, Iri<&str>, LocalTermRef<'_>, IdRef<'_>>
pub fn into_owned(self) -> LexicalQuad
Source§impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<S, P, O, G>
impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<S, P, O, G>
Sourcepub const fn new(subject: S, predicate: P, object: O, graph: Option<G>) -> Self
pub const fn new(subject: S, predicate: P, object: O, graph: Option<G>) -> Self
Creates a new quad.
Sourcepub const fn subject(&self) -> &S
pub const fn subject(&self) -> &S
Returns a reference to the subject of the quad, the first component.
Sourcepub const fn subject_mut(&mut self) -> &mut S
pub const fn subject_mut(&mut self) -> &mut S
Returns a mutable reference to the subject of the quad, the first component.
Sourcepub fn into_subject(self) -> S
pub fn into_subject(self) -> S
Turns the quad into its subject, the first component.
Sourcepub const fn predicate(&self) -> &P
pub const fn predicate(&self) -> &P
Returns a reference to the predicate of the quad, the second component.
Sourcepub const fn predicate_mut(&mut self) -> &mut P
pub const fn predicate_mut(&mut self) -> &mut P
Returns a mutable reference to the predicate of the quad, the second component.
Sourcepub fn into_predicate(self) -> P
pub fn into_predicate(self) -> P
Turns the quad into its predicate, the second component.
Sourcepub const fn object(&self) -> &O
pub const fn object(&self) -> &O
Returns a reference to the object of the quad, the third component.
Sourcepub const fn object_mut(&mut self) -> &mut O
pub const fn object_mut(&mut self) -> &mut O
Returns a mutable reference to the object of the quad, the third component.
Sourcepub fn into_object(self) -> O
pub fn into_object(self) -> O
Turns the quad into its object, the third component.
Sourcepub const fn graph(&self) -> Option<&G>
pub const fn graph(&self) -> Option<&G>
Returns a reference to the graph of the quad, the fourth component.
Sourcepub const fn graph_mut(&mut self) -> Option<&mut G>
pub const fn graph_mut(&mut self) -> Option<&mut G>
Returns a mutable reference to the graph of the quad, the fourth component.
Sourcepub fn into_graph(self) -> Option<G>
pub fn into_graph(self) -> Option<G>
Turns the quad into its graph, the fourth component.
pub fn into_parts(self) -> (S, P, O, Option<G>)
Sourcepub fn into_triple(self) -> (Triple<S, P, O>, Option<G>)
pub fn into_triple(self) -> (Triple<S, P, O>, Option<G>)
Turns this quad into a triple and its graph component.
Sourcepub fn map_subject<U: IsSubject>(
self,
f: impl FnOnce(S) -> U,
) -> Quad<U, P, O, G>
pub fn map_subject<U: IsSubject>( self, f: impl FnOnce(S) -> U, ) -> Quad<U, P, O, G>
Maps the subject with the given function.
Sourcepub fn map_predicate<U: IsPredicate>(
self,
f: impl FnOnce(P) -> U,
) -> Quad<S, U, O, G>
pub fn map_predicate<U: IsPredicate>( self, f: impl FnOnce(P) -> U, ) -> Quad<S, U, O, G>
Maps the predicate with the given function.
Sourcepub fn map_object<U: IsObject>(self, f: impl FnOnce(O) -> U) -> Quad<S, P, U, G>
pub fn map_object<U: IsObject>(self, f: impl FnOnce(O) -> U) -> Quad<S, P, U, G>
Maps the object with the given function.
Sourcepub fn map_graph<U: IsGraph>(
self,
f: impl FnOnce(Option<G>) -> Option<U>,
) -> Quad<S, P, O, U>
pub fn map_graph<U: IsGraph>( self, f: impl FnOnce(Option<G>) -> Option<U>, ) -> Quad<S, P, O, U>
Maps the graph with the given function.
pub fn with_graph(self, g: Option<G>) -> Self
Sourcepub fn map_all<S2: IsSubject, P2: IsPredicate, O2: IsObject, G2: IsGraph>(
self,
s: impl FnOnce(S) -> S2,
p: impl FnOnce(P) -> P2,
o: impl FnOnce(O) -> O2,
g: impl FnOnce(Option<G>) -> Option<G2>,
) -> Quad<S2, P2, O2, G2>
pub fn map_all<S2: IsSubject, P2: IsPredicate, O2: IsObject, G2: IsGraph>( self, s: impl FnOnce(S) -> S2, p: impl FnOnce(P) -> P2, o: impl FnOnce(O) -> O2, g: impl FnOnce(Option<G>) -> Option<G2>, ) -> Quad<S2, P2, O2, G2>
Maps every quad component with the given functions, one for each component.
Trait Implementations§
Source§impl<S: Clone + IsSubject, P: Clone + IsPredicate, O: Clone + IsObject, G: Clone + IsGraph> Clone for Quad<S, P, O, G>
impl<S: Clone + IsSubject, P: Clone + IsPredicate, O: Clone + IsObject, G: Clone + IsGraph> Clone for Quad<S, P, O, G>
impl<S: Copy + IsSubject, P: Copy + IsPredicate, O: Copy + IsObject, G: Copy + IsGraph> Copy for Quad<S, P, O, G>
Source§impl<S: Debug + IsSubject, P: Debug + IsPredicate, O: Debug + IsObject, G: Debug + IsGraph> Debug for Quad<S, P, O, G>
impl<S: Debug + IsSubject, P: Debug + IsPredicate, O: Debug + IsObject, G: Debug + IsGraph> Debug for Quad<S, P, O, G>
Source§impl<'de, S, P, O, G> Deserialize<'de> for Quad<S, P, O, G>where
S: Deserialize<'de> + IsSubject,
P: Deserialize<'de> + IsPredicate,
O: Deserialize<'de> + IsObject,
G: Deserialize<'de> + IsGraph,
impl<'de, S, P, O, G> Deserialize<'de> for Quad<S, P, O, G>where
S: Deserialize<'de> + IsSubject,
P: Deserialize<'de> + IsPredicate,
O: Deserialize<'de> + IsObject,
G: Deserialize<'de> + IsGraph,
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>,
Source§impl<S, P, O, G> Display for Quad<S, P, O, G>where
S: IsSubject + RdfDisplay,
P: IsPredicate + RdfDisplay,
O: IsObject + RdfDisplay,
G: IsGraph + RdfDisplay,
impl<S, P, O, G> Display for Quad<S, P, O, G>where
S: IsSubject + RdfDisplay,
P: IsPredicate + RdfDisplay,
O: IsObject + RdfDisplay,
G: IsGraph + RdfDisplay,
impl<S: Eq + IsSubject, P: Eq + IsPredicate, O: Eq + IsObject, G: Eq + IsGraph> Eq for Quad<S, P, O, G>
Source§impl<R: Resource + Clone + Ord> Extend<Quad<R, R, R, R>> for BTreeDataset<R>
impl<R: Resource + Clone + Ord> Extend<Quad<R, R, R, R>> for BTreeDataset<R>
Source§fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<R: Resource + Clone + Eq + Hash> Extend<Quad<R, R, R, R>> for HashDataset<R>
impl<R: Resource + Clone + Eq + Hash> Extend<Quad<R, R, R, R>> for HashDataset<R>
Source§fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<R: Resource + Clone + Ord> Extend<Quad<R, R, R, R>> for IndexedBTreeDataset<R>
impl<R: Resource + Clone + Ord> Extend<Quad<R, R, R, R>> for IndexedBTreeDataset<R>
Source§fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<R: Resource + Clone + Eq + Hash> Extend<Quad<R, R, R, R>> for IndexedHashDataset<R>
impl<R: Resource + Clone + Eq + Hash> Extend<Quad<R, R, R, R>> for IndexedHashDataset<R>
Source§fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl<T: Resource> From<Quad<Option<T>, Option<T>, Option<T>, Option<T>>> for CanonicalQuadPattern<T>
impl<T: Resource> From<Quad<Option<T>, Option<T>, Option<T>, Option<T>>> for CanonicalQuadPattern<T>
Source§impl<T: Resource, X: PartialEq> From<Quad<ResourceOrVar<T, X>, ResourceOrVar<T, X>, ResourceOrVar<T, X>, ResourceOrVar<T, X>>> for CanonicalQuadPattern<T>
impl<T: Resource, X: PartialEq> From<Quad<ResourceOrVar<T, X>, ResourceOrVar<T, X>, ResourceOrVar<T, X>, ResourceOrVar<T, X>>> for CanonicalQuadPattern<T>
Source§fn from(value: QuadPattern<T, X>) -> Self
fn from(value: QuadPattern<T, X>) -> Self
Source§impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> From<Quad<S, P, O, G>> for GeneralizedQuad<S, P, O, G>
impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> From<Quad<S, P, O, G>> for GeneralizedQuad<S, P, O, G>
Source§impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for BTreeDataset<R>
impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for BTreeDataset<R>
Source§impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for HashDataset<R>
impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for HashDataset<R>
Source§impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for IndexedBTreeDataset<R>
impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for IndexedBTreeDataset<R>
Source§impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for IndexedHashDataset<R>
impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for IndexedHashDataset<R>
Source§impl<S: Hash + IsSubject, P: Hash + IsPredicate, O: Hash + IsObject, G: Hash + IsGraph> Hash for Quad<S, P, O, G>
impl<S: Hash + IsSubject, P: Hash + IsPredicate, O: Hash + IsObject, G: Hash + IsGraph> Hash for Quad<S, P, O, G>
Source§impl<S: Ord + IsSubject, P: Ord + IsPredicate, O: Ord + IsObject, G: Ord + IsGraph> Ord for Quad<S, P, O, G>
impl<S: Ord + IsSubject, P: Ord + IsPredicate, O: Ord + IsObject, G: Ord + IsGraph> Ord for Quad<S, P, O, G>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<S1, P1, O1, G1, S2, P2, O2, G2> PartialEq<Quad<S2, P2, O2, G2>> for Quad<S1, P1, O1, G1>
impl<S1, P1, O1, G1, S2, P2, O2, G2> PartialEq<Quad<S2, P2, O2, G2>> for Quad<S1, P1, O1, G1>
Source§impl<S1, P1, O1, G1, S2, P2, O2, G2> PartialOrd<Quad<S2, P2, O2, G2>> for Quad<S1, P1, O1, G1>where
S1: IsSubject + PartialOrd<S2>,
P1: IsPredicate + PartialOrd<P2>,
O1: IsObject + PartialOrd<O2>,
G1: IsGraph + PartialOrd<G2>,
S2: IsSubject,
P2: IsPredicate,
O2: IsObject,
G2: IsGraph,
impl<S1, P1, O1, G1, S2, P2, O2, G2> PartialOrd<Quad<S2, P2, O2, G2>> for Quad<S1, P1, O1, G1>where
S1: IsSubject + PartialOrd<S2>,
P1: IsPredicate + PartialOrd<P2>,
O1: IsObject + PartialOrd<O2>,
G1: IsGraph + PartialOrd<G2>,
S2: IsSubject,
P2: IsPredicate,
O2: IsObject,
G2: IsGraph,
Source§impl<S, P, O, G> RdfDisplay for Quad<S, P, O, G>where
S: IsSubject + RdfDisplay,
P: IsPredicate + RdfDisplay,
O: IsObject + RdfDisplay,
G: IsGraph + RdfDisplay,
impl<S, P, O, G> RdfDisplay for Quad<S, P, O, G>where
S: IsSubject + RdfDisplay,
P: IsPredicate + RdfDisplay,
O: IsObject + RdfDisplay,
G: IsGraph + RdfDisplay,
Source§fn rdf_fmt(&self, f: &mut Formatter<'_>) -> Result
fn rdf_fmt(&self, f: &mut Formatter<'_>) -> Result
Source§fn rdf_display(&self) -> RdfDisplayed<&Self>
fn rdf_display(&self) -> RdfDisplayed<&Self>
Auto Trait Implementations§
impl<S, P, O, G> Freeze for Quad<S, P, O, G>
impl<S, P, O, G> RefUnwindSafe for Quad<S, P, O, G>
impl<S, P, O, G> Send for Quad<S, P, O, G>
impl<S, P, O, G> Sync for Quad<S, P, O, G>
impl<S, P, O, G> Unpin for Quad<S, P, O, G>
impl<S, P, O, G> UnsafeUnpin for Quad<S, P, O, G>
impl<S, P, O, G> UnwindSafe for Quad<S, P, O, G>
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> 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
key and return true if they are equal.