Function flowclib::dumper::dump_tables::dump_tables [−][src]
pub fn dump_tables(
tables: &GenerationTables,
output_dir: &Path
) -> Result<String>
dump a flow’s compiler tables that were constructed for use in code generation
Example
use std::env; use url::Url; use provider::content::provider::Provider; use provider::errors::Result; use flowclib::model::process::Process::FlowProcess; struct DummyProvider {} impl Provider for DummyProvider { fn resolve_url(&self, url: &str, default_filename: &str, _ext: &[&str]) -> Result<(String, Option<String>)> { Ok((url.to_string(), None)) } fn get_contents(&self, url: &str) -> Result<Vec<u8>> { Ok("flow = \"dummy\"".as_bytes().to_owned()) } } let dummy_provider = DummyProvider {}; let mut url = url::Url::from_file_path(env::current_dir().unwrap()).unwrap(); println!("url = {:?}", url); url = url.join("samples/hello-world-simple/context.toml").unwrap(); if let FlowProcess(mut flow) = flowclib::compiler::loader::load(&url.to_string(), &dummy_provider).unwrap() { let tables = flowclib::compiler::compile::compile(&mut flow).unwrap(); let output_dir = tempdir::TempDir::new("flow").unwrap().into_path(); let tables = flowclib::compiler::compile::compile(&mut flow).unwrap(); let output_dir = tempdir::TempDir::new("dumper").unwrap().into_path(); flowclib::dumper::dump_tables::dump_tables(&tables, &output_dir).unwrap(); }