Skip to main content

Quad

Struct Quad 

Source
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<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<S, P, O, G>

Source

pub const fn as_ref(&self) -> Quad<&S, &P, &O, &G>

Borrows each component of the quad.

Source§

impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<&S, &P, &O, &G>

Source

pub fn cloned(&self) -> Quad<S, P, O, G>
where S: Clone, P: Clone, O: Clone, G: Clone,

Source

pub fn into_cloned(self) -> Quad<S, P, O, G>
where S: Clone, P: Clone, O: Clone, G: Clone,

Source§

impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<&S, &P, &O, &G>

Source

pub const fn copied(&self) -> Quad<S, P, O, G>
where S: Copy, P: Copy, O: Copy, G: Copy,

Source

pub const fn into_copied(self) -> Quad<S, P, O, G>
where S: Copy, P: Copy, O: Copy, G: Copy,

Source§

impl Quad

Source§

impl Quad<IdRef<'_>, Iri<&str>, LocalTermRef<'_>, IdRef<'_>>

Source§

impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> Quad<S, P, O, G>

Source

pub const fn new(subject: S, predicate: P, object: O, graph: Option<G>) -> Self

Creates a new quad.

Source

pub const fn subject(&self) -> &S

Returns a reference to the subject of the quad, the first component.

Source

pub const fn subject_mut(&mut self) -> &mut S

Returns a mutable reference to the subject of the quad, the first component.

Source

pub fn into_subject(self) -> S

Turns the quad into its subject, the first component.

Source

pub const fn predicate(&self) -> &P

Returns a reference to the predicate of the quad, the second component.

Source

pub const fn predicate_mut(&mut self) -> &mut P

Returns a mutable reference to the predicate of the quad, the second component.

Source

pub fn into_predicate(self) -> P

Turns the quad into its predicate, the second component.

Source

pub const fn object(&self) -> &O

Returns a reference to the object of the quad, the third component.

Source

pub const fn object_mut(&mut self) -> &mut O

Returns a mutable reference to the object of the quad, the third component.

Source

pub fn into_object(self) -> O

Turns the quad into its object, the third component.

Source

pub const fn graph(&self) -> Option<&G>

Returns a reference to the graph of the quad, the fourth component.

Source

pub const fn graph_mut(&mut self) -> Option<&mut G>

Returns a mutable reference to the graph of the quad, the fourth component.

Source

pub fn into_graph(self) -> Option<G>

Turns the quad into its graph, the fourth component.

Source

pub fn into_parts(self) -> (S, P, O, Option<G>)

Source

pub fn into_triple(self) -> (Triple<S, P, O>, Option<G>)

Turns this quad into a triple and its graph component.

Source

pub fn map_subject<U: IsSubject>( self, f: impl FnOnce(S) -> U, ) -> Quad<U, P, O, G>

Maps the subject with the given function.

Source

pub fn map_predicate<U: IsPredicate>( self, f: impl FnOnce(P) -> U, ) -> Quad<S, U, O, G>

Maps the predicate with the given function.

Source

pub fn map_object<U: IsObject>(self, f: impl FnOnce(O) -> U) -> Quad<S, P, U, G>

Maps the object with the given function.

Source

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.

Source

pub fn with_graph(self, g: Option<G>) -> Self

Source

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.

Source§

impl<T: IsSubject + IsPredicate + IsObject + IsGraph> Quad<T, T, T, T>

Source

pub fn map<U: IsSubject + IsPredicate + IsObject + IsGraph>( self, f: impl FnMut(T) -> U, ) -> Quad<U, U, U, U>

Maps the components with the given function.

Source§

impl<S, P, O, G> Quad<S, P, O, G>

Source

pub fn strip_all_but_predicate( self, ) -> Quad<S::Stripped, P, O::Stripped, G::Stripped>

Strips metadata from subject, object, and graph, leaving the predicate untouched.

Trait Implementations§

Source§

impl<S: Clone + IsSubject, P: Clone + IsPredicate, O: Clone + IsObject, G: Clone + IsGraph> Clone for Quad<S, P, O, G>

Source§

fn clone(&self) -> Quad<S, P, O, G>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<S, P, O, G> Display for Quad<S, P, O, G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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>

Source§

fn extend<T: IntoIterator<Item = Quad<R, R, R, R>>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

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)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

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)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

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)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: Resource> From<Quad<Option<T>, Option<T>, Option<T>, Option<T>>> for CanonicalQuadPattern<T>

Source§

fn from(value: Quad<Option<T>, Option<T>, Option<T>, Option<T>>) -> Self

Converts to this type from the input type.
Source§

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

Converts to this type from the input type.
Source§

impl<S: IsSubject, P: IsPredicate, O: IsObject, G: IsGraph> From<Quad<S, P, O, G>> for GeneralizedQuad<S, P, O, G>

Source§

fn from(q: Quad<S, P, O, G>) -> Self

Converts to this type from the input type.
Source§

impl<T: Resource> From<Quad<T, T, T, T>> for CanonicalQuadPattern<T>

Source§

fn from(value: Quad<T, T, T, T>) -> Self

Converts to this type from the input type.
Source§

impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for BTreeDataset<R>

Source§

fn from_iter<T: IntoIterator<Item = Quad<R, R, R, R>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for HashDataset<R>

Source§

fn from_iter<T: IntoIterator<Item = Quad<R, R, R, R>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<R: Resource + Clone + Ord> FromIterator<Quad<R, R, R, R>> for IndexedBTreeDataset<R>

Source§

fn from_iter<T: IntoIterator<Item = Quad<R, R, R, R>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<R: Resource + Clone + Eq + Hash> FromIterator<Quad<R, R, R, R>> for IndexedHashDataset<R>

Source§

fn from_iter<T: IntoIterator<Item = Quad<R, R, R, R>>>(iter: T) -> Self

Creates a value from an iterator. Read more
Source§

impl<S: Hash + IsSubject, P: Hash + IsPredicate, O: Hash + IsObject, G: Hash + IsGraph> Hash for Quad<S, P, O, G>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<S: Ord + IsSubject, P: Ord + IsPredicate, O: Ord + IsObject, G: Ord + IsGraph> Ord for Quad<S, P, O, G>

Source§

fn cmp(&self, other: &Quad<S, P, O, G>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<S1, P1, O1, G1, S2, P2, O2, G2> PartialEq<Quad<S2, P2, O2, G2>> for Quad<S1, P1, O1, G1>
where S1: IsSubject + PartialEq<S2>, P1: IsPredicate + PartialEq<P2>, O1: IsObject + PartialEq<O2>, G1: IsGraph + PartialEq<G2>, S2: IsSubject, P2: IsPredicate, O2: IsObject, G2: IsGraph,

Source§

fn eq(&self, other: &Quad<S2, P2, O2, G2>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
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,

Source§

fn partial_cmp(&self, other: &Quad<S2, P2, O2, G2>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<S, P, O, G> RdfDisplay for Quad<S, P, O, G>

Source§

fn rdf_fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
Source§

fn rdf_display(&self) -> RdfDisplayed<&Self>

Prepare the value to be formatted as an RDF syntax element.
Source§

impl<S, P, O, G> Serialize for Quad<S, P, O, G>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<S, P, O, G> Strip for Quad<S, P, O, G>

Source§

type Stripped = Quad<<S as Strip>::Stripped, <P as Strip>::Stripped, <O as Strip>::Stripped, <G as Strip>::Stripped>

Source§

fn strip(self) -> Self::Stripped

Auto Trait Implementations§

§

impl<S, P, O, G> Freeze for Quad<S, P, O, G>
where S: Freeze, P: Freeze, O: Freeze, G: Freeze,

§

impl<S, P, O, G> RefUnwindSafe for Quad<S, P, O, G>

§

impl<S, P, O, G> Send for Quad<S, P, O, G>
where S: Send, P: Send, O: Send, G: Send,

§

impl<S, P, O, G> Sync for Quad<S, P, O, G>
where S: Sync, P: Sync, O: Sync, G: Sync,

§

impl<S, P, O, G> Unpin for Quad<S, P, O, G>
where S: Unpin, P: Unpin, O: Unpin, G: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<T> WithContext for T
where T: ?Sized,

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>
where T: Sized,