pub trait Triple<S, P, O>:
Debug
+ Clone
+ Display{
// Required methods
fn new(subj: impl Into<S>, pred: impl Into<P>, obj: impl Into<O>) -> Self;
fn subj(&self) -> &S;
fn pred(&self) -> &P;
fn obj(&self) -> &O;
fn into_components(self) -> (S, P, O);
// Provided methods
fn into_subject(self) -> S { ... }
fn into_predicate(self) -> P { ... }
fn into_object(self) -> O { ... }
}Expand description
Represents an RDF triple.
An RDF triple consists of three components: a subject, a predicate, and an object.
§Type Parameters
S- The subject type, which must implementSubjectP- The predicate type, which must implementIriO- The object type, which must implementTerm
Required Methods§
Sourcefn new(subj: impl Into<S>, pred: impl Into<P>, obj: impl Into<O>) -> Self
fn new(subj: impl Into<S>, pred: impl Into<P>, obj: impl Into<O>) -> Self
Constructs a new RDF triple from the given components.
§Parameters
subj- The subject of the triple, convertible to typeSpred- The predicate of the triple, convertible to typePobj- The object of the triple, convertible to typeO
Sourcefn into_components(self) -> (S, P, O)
fn into_components(self) -> (S, P, O)
Consumes the triple and returns its components as a tuple.
This method takes ownership of the triple and returns (subject, predicate, object),
allowing you to extract the individual components without cloning.
Provided Methods§
Sourcefn into_subject(self) -> S
fn into_subject(self) -> S
Consumes the triple and returns only the subject.
Sourcefn into_predicate(self) -> P
fn into_predicate(self) -> P
Consumes the triple and returns only the predicate.
Sourcefn into_object(self) -> O
fn into_object(self) -> O
Consumes the triple and returns only the object.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Triple<NamedOrBlankNode, NamedNode, Term> for Triple
Implements the Triple trait for OxTriple.
impl Triple<NamedOrBlankNode, NamedNode, Term> for Triple
Implements the Triple trait for OxTriple.
Provides construction, field access, and decomposition for RDF triples consisting of subject, predicate, and object.
Source§fn new(
subj: impl Into<OxSubject>,
pred: impl Into<OxNamedNode>,
obj: impl Into<OxTerm>,
) -> Self
fn new( subj: impl Into<OxSubject>, pred: impl Into<OxNamedNode>, obj: impl Into<OxTerm>, ) -> Self
Creates a new RDF triple from subject, predicate, and object.
§Parameters
subj: The subject (IRI or blank node)pred: The predicate (IRI/named node)obj: The object (IRI, blank node, literal, or quoted triple)
Source§fn pred(&self) -> &OxNamedNode
fn pred(&self) -> &OxNamedNode
Returns a reference to the predicate of this triple.
Source§fn into_components(self) -> (OxSubject, OxNamedNode, OxTerm)
fn into_components(self) -> (OxSubject, OxNamedNode, OxTerm)
Consumes the triple and returns its components.
This method is useful when you need owned values rather than references, avoiding additional clones.