pub struct Writer<W> { /* private fields */ }
Expand description

A writer for CoNLL-U sentences.

This writer will write sentences to the embedded writer in CoNLL-U tabular format.

Implementations

Construct a new writer from an object that implements the Write trait.

Borrow the embedded writer. Getting the underlying writer is often useful when the writer writes to a memory object.

Examples
use std::str;

use conllu::io::{Writer, WriteSentence};
use udgraph::graph::Sentence;
use udgraph::token::Token;

let output = Vec::new();
let mut writer = Writer::new(output);
let mut sent = Sentence::new();
sent.push(Token::new("hello"));
sent.push(Token::new("world"));

writer.write_sentence(&sent).unwrap();

println!("Output:\n{}", str::from_utf8(writer.get_ref()).unwrap());

Trait Implementations

Write a sentence into this object. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.