[][src]Struct sise::TreeWriter

pub struct TreeWriter { /* fields omitted */ }

A writer that creates a tree of Node.

Example

use sise::sise_expr;
use sise::Writer as _;

let mut writer = sise::TreeWriter::new();

writer.begin_list(()).unwrap();
writer.write_atom("example", ()).unwrap();
writer.begin_list(()).unwrap();
writer.write_atom("1", ()).unwrap();
writer.write_atom("2", ()).unwrap();
writer.write_atom("3", ()).unwrap();
writer.end_list(()).unwrap();
writer.begin_list(()).unwrap();
writer.write_atom("a", ()).unwrap();
writer.write_atom("b", ()).unwrap();
writer.write_atom("c", ()).unwrap();
writer.end_list(()).unwrap();
writer.end_list(()).unwrap();
let result = writer.finish(()).unwrap();

let expected_result = sise_expr!(["example", ["1", "2", "3"], ["a", "b", "c"]]);
assert_eq!(result, expected_result);

Methods

impl TreeWriter[src]

pub fn new() -> Self[src]

Trait Implementations

impl Writer for TreeWriter[src]

type Result = Node

Type of data returned by the writer.

type Error = Infallible

The error type that may be produced while writing.

type AtomOptions = ()

Type of options that can be passed to write_atom.

type BeginListOptions = ()

Type of options that can be passed to begin_list.

type EndListOptions = ()

Type of options that can be passed to end_list.

type FinishOptions = ()

Type of options that can be passed to finish.

impl Default for TreeWriter[src]

Auto Trait Implementations

Blanket Implementations

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 = !

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.

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

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

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