Struct rio_turtle::NTriplesFormatter[][src]

pub struct NTriplesFormatter<W: Write> { /* fields omitted */ }

A Canonical N-Triples formatter.

It implements the TriplesFormatter trait.

Write some triples using the TriplesFormatter API into a Vec buffer:

use rio_turtle::NTriplesFormatter;
use rio_api::formatter::TriplesFormatter;
use rio_api::model::{NamedNode, Triple};

let mut formatter = NTriplesFormatter::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 _ntriples = formatter.finish();

Implementations

impl<W: Write> NTriplesFormatter<W>[src]

pub fn new(write: W) -> Self[src]

Builds a new formatter from a Write implementation

pub fn finish(self) -> W[src]

Finishes writing and returns the underlying Write

Trait Implementations

impl<W: Write> TriplesFormatter for NTriplesFormatter<W>[src]

type Error = Error

Auto Trait Implementations

impl<W> RefUnwindSafe for NTriplesFormatter<W> where
    W: RefUnwindSafe
[src]

impl<W> Send for NTriplesFormatter<W> where
    W: Send
[src]

impl<W> Sync for NTriplesFormatter<W> where
    W: Sync
[src]

impl<W> Unpin for NTriplesFormatter<W> where
    W: Unpin
[src]

impl<W> UnwindSafe for NTriplesFormatter<W> where
    W: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.