pub struct GraphSerializer { /* private fields */ }
๐Deprecated since 0.4.0: use RdfSerializer instead
Expand description
A serializer for RDF graph serialization formats.
It currently supports the following formats:
use oxigraph::io::{GraphFormat, GraphSerializer};
use oxigraph::model::*;
let mut buffer = Vec::new();
let mut serializer =
GraphSerializer::from_format(GraphFormat::NTriples).triple_writer(&mut buffer);
serializer.write(&Triple {
subject: NamedNode::new("http://example.com/s")?.into(),
predicate: NamedNode::new("http://example.com/p")?,
object: NamedNode::new("http://example.com/o")?.into(),
})?;
serializer.finish()?;
assert_eq!(
buffer.as_slice(),
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n".as_bytes()
);
Implementationsยง
Sourceยงimpl GraphSerializer
impl GraphSerializer
Sourcepub fn from_format(format: GraphFormat) -> Self
pub fn from_format(format: GraphFormat) -> Self
Builds a serializer for the given format
Sourcepub fn triple_writer<W: Write>(self, writer: W) -> TripleWriter<W>
pub fn triple_writer<W: Write>(self, writer: W) -> TripleWriter<W>
Returns a TripleWriter
allowing writing triples into the given Write
implementation
Auto Trait Implementationsยง
impl Freeze for GraphSerializer
impl RefUnwindSafe for GraphSerializer
impl Send for GraphSerializer
impl Sync for GraphSerializer
impl Unpin for GraphSerializer
impl UnwindSafe for GraphSerializer
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