pub struct GraphORMMeta<T>{ /* private fields */ }Expand description
A descriptor to track meta information about the serialisation of some target on the graph.
This is necessary because simply keeping the target object would cause loss
of information. For example, if a struct is deserialised from a graph (e.g.
by calling GraphORM::deserialize), the original subject needs to be noted.
Implementations§
Source§impl<T> GraphORMMeta<T>
impl<T> GraphORMMeta<T>
Sourcepub fn new(thing: T) -> Self
pub fn new(thing: T) -> Self
Wrap a target into the descriptor.
This function consumes the target and stores it.
Sourcepub fn into_deref(self) -> T
pub fn into_deref(self) -> T
Unwrap the target.
Sourcepub fn with_subject(self, subject: Arc<Term>) -> Self
pub fn with_subject(self, subject: Arc<Term>) -> Self
Add a pre-defined subject to the descriptor.
Subsequent serialisations will use this subject.
Sourcepub fn fixate_subject(&mut self) -> Result<(), GraphORMError>
pub fn fixate_subject(&mut self) -> Result<(), GraphORMError>
Fixate the subject generated by the target.
This calls GraphORM::rdf_subject once and stores the generated subject for later re-use.
If the subject mode already is SubjectMode::Static, this function does not change the subject.
pub fn subject(&self) -> Result<Arc<Term>, GraphORMError>
Sourcepub fn serialize_stream(
&self,
) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send + use<'_, T>, GraphORMError>
pub fn serialize_stream( &self, ) -> Result<impl Stream<Item = Arc<Triple>> + Unpin + Send + use<'_, T>, GraphORMError>
Serialise the target into a stream of triples.
This is a proxy for GraphORM::serialize_stream of the target, injecting the desired subject.
Sourcepub async fn serialize(
&self,
graph: &mut impl Graph,
) -> Result<(), GraphORMError>
pub async fn serialize( &self, graph: &mut impl Graph, ) -> Result<(), GraphORMError>
Serialize the target into an existing Graph.
This method calls the Graph::merge_stream method, passing the stream of triples for the target to it.
Trait Implementations§
Source§impl<T> Clone for GraphORMMeta<T>
impl<T> Clone for GraphORMMeta<T>
Source§fn clone(&self) -> GraphORMMeta<T>
fn clone(&self) -> GraphORMMeta<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more