flowlang/
lib.rs

1pub mod flowlang;
2
3pub mod code;
4pub mod case;
5pub mod command;
6pub mod datastore;
7pub mod primitives;
8pub mod rustcmd;
9pub mod rand;
10pub mod builder;
11pub mod buildrust;
12pub mod rfc2822date;
13pub mod sha1;
14pub mod base64;
15pub mod appserver;
16pub mod x25519;
17pub mod mcp;
18
19pub mod cmdinit;
20
21#[cfg(feature="java_runtime")]
22pub mod javacmd;
23#[cfg(feature="javascript_runtime")]
24pub mod jscmd;
25#[cfg(feature="python_runtime")]
26pub mod pyenv;
27#[cfg(feature="python_runtime")]
28pub mod pywrapper;
29pub mod pycmd;
30
31use datastore::DataStore;
32use ndata::NDataConfig;
33use crate::cmdinit::*;
34use crate::rustcmd::RustCmd;
35use ndata::dataobject::DataObject;
36
37pub type Transform = fn(DataObject) -> DataObject;
38
39
40pub fn init(dir:&str) -> (&str, NDataConfig) {
41  //println!("flowlang::init()");
42  let q = DataStore::init(dir);
43  let mut v = Vec::new();
44  cmdinit(&mut v);
45  //for q in &v { RustCmd::add(q.0.to_owned(), q.1, q.2.to_owned()); }
46
47  let mut cmd_map = DataObject::new();
48  DataStore::globals().put_object("RUST_COMMANDS", cmd_map.clone());
49
50  for q in &v {
51    // Create a new object to hold the command's details.
52    let cmd_details = RustCmd::detail(q.0.to_owned(), q.1, q.2.to_owned());
53    // Put the details object into the main command map.
54    //println!("INIT ADDING RUST COMMAND {}:{}", q.0, cmd_details.to_string());
55    cmd_map.put_object(&q.0, cmd_details);
56  }
57  q
58}
59
60pub fn mirror(q:(&str, NDataConfig)) {
61  //println!("flowlang::mirror()");
62  DataStore::mirror(q);
63  let mut v = Vec::new();
64  cmdinit(&mut v);
65  //for q in &v { RustCmd::add(q.0.to_owned(), q.1, q.2.to_owned()); }
66  let mut cmd_map = DataStore::globals().get_object("RUST_COMMANDS");
67
68  for q in &v {
69    // Create a new object to hold the command's details.
70    let cmd_details = RustCmd::detail(q.0.to_owned(), q.1, q.2.to_owned());
71    // Put the details object into the main command map.
72    //println!("MIRROR ADDING RUST COMMAND {}:{}", q.0, cmd_details.to_string());
73    cmd_map.put_object(&q.0, cmd_details);
74  }
75}
76