[−][src]Struct sise::TreeWriter
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]
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
.
fn write_atom(&mut self, atom: &str, _opts: ()) -> Result<(), Infallible>
[src]
fn begin_list(&mut self, _opts: ()) -> Result<(), Infallible>
[src]
fn end_list(&mut self, _opts: ()) -> Result<(), Infallible>
[src]
fn finish(self, _opts: ()) -> Result<Node, Infallible>
[src]
impl Default for TreeWriter
[src]
Auto Trait Implementations
impl Send for TreeWriter
impl Sync for TreeWriter
impl Unpin for TreeWriter
impl UnwindSafe for TreeWriter
impl RefUnwindSafe for TreeWriter
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,