Struct rio_xml::RdfXmlFormatter
source · [−]pub struct RdfXmlFormatter<W: Write> { /* private fields */ }Expand description
A RDF/XML formatter.
It implements the TriplesFormatter trait.
Write some triples using the TriplesFormatter API into a Vec buffer:
use rio_xml::RdfXmlFormatter;
use rio_api::formatter::TriplesFormatter;
use rio_api::model::{NamedNode, Triple};
let mut formatter = RdfXmlFormatter::new(Vec::default())?;
formatter.format(&Triple {
subject: NamedNode { iri: "http://example.com/foo" }.into(),
predicate: NamedNode { iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }.into(),
object: NamedNode { iri: "http://schema.org/Person" }.into()
})?;
let _xml = formatter.finish()?;Implementations
sourceimpl<W: Write> RdfXmlFormatter<W>
impl<W: Write> RdfXmlFormatter<W>
sourcepub fn new(write: W) -> Result<Self>
pub fn new(write: W) -> Result<Self>
Builds a new formatter from a Write implementation and starts writing
sourcepub fn with_indentation(write: W, indentation_size: usize) -> Result<Self>
pub fn with_indentation(write: W, indentation_size: usize) -> Result<Self>
Builds a new formatter from a Write implementation and starts writing.
The output is indented with indentation_size spaces.
Trait Implementations
Auto Trait Implementations
impl<W> RefUnwindSafe for RdfXmlFormatter<W> where
W: RefUnwindSafe,
impl<W> Send for RdfXmlFormatter<W> where
W: Send,
impl<W> Sync for RdfXmlFormatter<W> where
W: Sync,
impl<W> Unpin for RdfXmlFormatter<W> where
W: Unpin,
impl<W> UnwindSafe for RdfXmlFormatter<W> where
W: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more