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
- ATree
that will be returned as YAML data.
Errors
- An
ExportError
will be returned if the tree is not considered legal to export. See also: validation rules.
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);