Function convo::exporter::tree_to_source[][src]

pub fn tree_to_source(tree: &Tree) -> Result<String, ExportError>
Expand description

Try to returns a String which is generated as YAML from a Tree.

Arguments

  • tree - A Tree that will be returned as YAML data.

Errors

Examples

use convo::{importer, exporter};
let source = r#"---
root: start
nodes:
  start:
    dialogue: I am a recursive node.
    links:
      - start: Recurse!"#;
let tree = importer::source_to_tree(source).unwrap();
let source2 = exporter::tree_to_source(&tree).unwrap();
assert_eq!(source, source2);