Struct shm_rs::static_scheme::scheme::Serializator
source · pub struct Serializator { /* private fields */ }
Expand description
This struct contains information about the Serializator instance which is defined in scheme and starting with (serialization “name” …).
Implementations§
source§impl Serializator
impl Serializator
sourcepub const SERIALIZATOR_FROM_MEMORY_PATH: &'static str = "from memory"
pub const SERIALIZATOR_FROM_MEMORY_PATH: &'static str = "from memory"
Returned instead of path when path is None
sourcepub fn new(name: String) -> Self
pub fn new(name: String) -> Self
Creates new instance of serializator and sets the name
provided in the scheme.
sourcepub fn set_file_path(&mut self, file_path: Option<PathBuf>)
pub fn set_file_path(&mut self, file_path: Option<PathBuf>)
Sets to the created instance a path to the file which was used to generate current instance.
sourcepub fn get_file_path(&self) -> Option<&PathBuf>
pub fn get_file_path(&self) -> Option<&PathBuf>
sourcepub fn get_file_path_string_safe(&self) -> String
pub fn get_file_path_string_safe(&self) -> String
Returns a path or constant SERIALIZATOR_FROM_MEMORY_PATH if it was generated from memory.
sourcepub fn get_defines_by_proc_dt(
&self,
proc_name: &String,
arg_dt: ArgDataType
) -> Vec<Rc<Define>>
pub fn get_defines_by_proc_dt( &self, proc_name: &String, arg_dt: ArgDataType ) -> Vec<Rc<Define>>
Returns a list of references to the Define instance by the defined parameters.
The Define instance is defined to be used in proc_name
procedure and contain
data with the exact arg_dt
data type.
Arguments
-
proc_name
- a name of the procedure. -
arg_dt
- a ArgDataType data type.
Return
sourcepub fn resolve_path_to_struct(
&self,
source: Rc<Procedure>,
path_to_label: &[String],
full_path_to_lbl: &[String]
) -> StaticSchemeRes<(Rc<Structure>, Rc<Procedure>)>
pub fn resolve_path_to_struct( &self, source: Rc<Procedure>, path_to_label: &[String], full_path_to_lbl: &[String] ) -> StaticSchemeRes<(Rc<Structure>, Rc<Procedure>)>
Searches for a Structure (and Procedure) from the point specified by
argument source
which is Procedure.
This function is recursive!
Arguments
-
source
- a point from where the item from argumentpath_to_label
is resolved. -
path_to_label
- a path (by labels) to the target.
Returns
Returns a SchemeResult where:
-
On success returns Result::Ok with reference to Structure and Rc to Procedure
-
On error, returns Result::Err with error description.
sourcepub fn resolve_path_to_proc(
&self,
source: Rc<Procedure>,
path_to_label: &[String],
full_path_to_lbl: &[String]
) -> StaticSchemeRes<(Option<Rc<Structure>>, Rc<Procedure>)>
pub fn resolve_path_to_proc( &self, source: Rc<Procedure>, path_to_label: &[String], full_path_to_lbl: &[String] ) -> StaticSchemeRes<(Option<Rc<Structure>>, Rc<Procedure>)>
sourcepub fn resolve_path_to_enum(
&self,
source: Rc<Procedure>,
path_to_label: &[String],
full_path_to_lbl: &[String]
) -> StaticSchemeRes<(Rc<Enumerator>, Rc<Procedure>)>
pub fn resolve_path_to_enum( &self, source: Rc<Procedure>, path_to_label: &[String], full_path_to_lbl: &[String] ) -> StaticSchemeRes<(Rc<Enumerator>, Rc<Procedure>)>
Searches for a Enumerator (and Procedure) from the point specified by
argument source
which is Procedure.
This function is recursive!
Arguments
-
source
- a point from where the item from argumentpath_to_label
is resolved. -
path_to_label
- a path (by labels) to the target.
Returns
Returns a SchemeResult where:
-
On success returns Result::Ok with reference to Enumerator and Rc to Procedure
-
On error, returns Result::Err with error description.
sourcepub fn resolve_path_to_arg(
&self,
source: Rc<Procedure>,
path_to_label: &[String],
full_path_to_lbl: &[String]
) -> StaticSchemeRes<Rc<Argument>>
pub fn resolve_path_to_arg( &self, source: Rc<Procedure>, path_to_label: &[String], full_path_to_lbl: &[String] ) -> StaticSchemeRes<Rc<Argument>>
Searches for a Argument from the point specified by
argument source
which is Procedure.
This function is recursive!
Arguments
-
source
- a point from where the item from argumentpath_to_label
is resolved. -
path_to_label
- a path (by labels) to the target.
Returns
Returns a SchemeResult where:
-
On success returns Result::Ok with reference to Rc Argument
-
On error, returns Result::Err with error description.
sourcepub fn generate_rust_structs(
&self,
rust_code: &mut RustCode
) -> StaticSchemeRes<()>
pub fn generate_rust_structs( &self, rust_code: &mut RustCode ) -> StaticSchemeRes<()>
Generates a Rust code (structures and enums) from the root of the document.
Arguments
rust_code
- a mutable reference to RustCode instance which is used to collect result.
Returns
A SchemeResult is returned.
-
Result::Ok - if operation is successful.
-
Result::Err - if operation has failed and error is returned.
Examples found in repository?
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
fn main()
{
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/defines_init.shm");
println!("{}", curdir.display());
let lex = lexer::Lexer::from_file(curdir).unwrap();
let schm = init::SchemeInit::new().unwrap();
let res = schm.run(&lex, None).unwrap();
println!("{:?}", res);
let resser = res.get("defines").unwrap().clone();
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
}
More examples
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/complex_example_1/init_networking.shm", None).unwrap();
let resser = res.get("networking").unwrap().clone();
let anres = resser.analyze().unwrap();
println!("errors:\n{}", anres);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/complex_example_1/init_networking_dyn1.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap();
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
}
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/scheme_proc_enum/init_use1.shm", None).unwrap();
let resser = res.get("use1").unwrap().clone();
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/scheme_proc_enum/init_use_dyn1.shm");
// let lex = lexer::Lexer::from_file(curdir).unwrap();
let (_dynenv, dyn_res) =
environment::DynEnvironment::from_file(curdir, resser.clone()).unwrap();
// let dynenv = environment::DynEnvironment::new_root(resser.clone());
//let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let local_inst =
TestUseEnum::ColorRgbaProfile
{
profile_name: "profile1".to_string(),
col_r: 6,
col_g: 5,
col_b: 64,
col_a: 100
};
let local_inst_ser = serde_json::to_string(&local_inst).unwrap();
assert_eq!(local_inst_ser.as_str(), serialized.as_str());
let deserialized: TestUseEnum = serde_json::from_str(&serialized).unwrap();
println!("Deserialized result: \n{:?}", deserialized);
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
panic!("{}", e);
}
}
}
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
fn main()
{
let curdir = std::env::current_dir().unwrap();
//curdir.push("examples/test3.shm");
println!("{}", curdir.display());
// let lex = lexer::Lexer::from_file(curdir).unwrap();
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/scheme_enum/init_enum.shm", None).unwrap();
let resser = res.get("test1").unwrap().clone();
println!("{:?}", res);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/scheme_enum/enum.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap();
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
//println!("dynproc:\n{:?}\n", dyn_res);
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let _deserialized: CommonLevels = serde_json::from_str(&serialized).unwrap();
let lvls =
CommonLevels
{
enum1: MyEnum::Item1,
enum2: OurEnum::Item2,
enum3: MyEnum::Item2,
enum4: vec![OurEnum::H_item1, OurEnum::Item2, OurEnum::C_item],
};
let serialized_nat = serde_json::to_string(&lvls).unwrap();
println!("nat:{}", serialized_nat);
println!("ser:{}", serialized);
if serialized != serialized_nat
{
panic!("not equal");
}
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
panic!("{}", e);
}
}
}
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
// init parser instance
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
// read a static scheme which describes our data structures i.e files filters.shm and logsmon.shm
let mut res = schm.run_from_file("examples/common_search/filters.shm", None).unwrap();
res.merge(schm.run_from_file("examples/common_search/logsmon.shm", None).unwrap());
// get our serializator instance which was parsed from static file
let resser = res.get("filters").unwrap().clone();
// creating new `RustCode` instance where the data structs from serializator `filters` will be placed
let mut rc1 = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
resser.generate_rust_structs(&mut rc1).unwrap();
// creating new `RustCode` instance where the data structs from serializator `logsmon` will be placed
let resser = res.get("logsmon").unwrap().clone();
let mut rc2 = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
resser.generate_rust_structs(&mut rc2).unwrap();
println!("after removing commons");
// search for common structs/enums between RustCode instances for filter.shm and logsmon.shm
let t = std::time::Instant::now();
let com_res = RustCode::search_common("super::structs::struct_common", vec!(&mut rc1, &mut rc2), &["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
let s = t.elapsed();
println!("time taken: {:?}", s);
println!("{}", rc1);
println!("{}", rc2);
// if something was found, then it will be stored in inner type of Option
if com_res.is_some() == true
{
println!("Common structs: \n\n{}", com_res.unwrap());
}
}
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
fn main()
{
let curdir = std::env::current_dir().unwrap();
//curdir.push("examples/test3.shm");
println!("{}", curdir.display());
// let lex = lexer::Lexer::from_file(curdir).unwrap();
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/test3.shm", None).unwrap();
let resser = res.get("test1").unwrap().clone();
println!("{:?}", res);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/test2.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap();
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
//println!("dynproc:\n{:?}\n", dyn_res);
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let _deserialized: CommonLevels = serde_json::from_str(&serialized).unwrap();
let lvls =
Levels
{
name: "testing1234".to_string(),
ch_a: Some(100),
ch_b: 2,
g_type: vec![GeomType::Line(4, 6, 5), GeomType::Ray{l: 56, w: 44}, GeomType::Test],
};
let cl = CommonLevels{lvl: lvls};
let serialized_nat = serde_json::to_string(&cl).unwrap();
println!("nat:{}", serialized_nat);
println!("ser:{}", serialized);
if serialized != serialized_nat
{
println!("not equal");
}
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
}
sourcepub fn generate_field_data_type(
&self,
rust_code: &mut RustCode,
field: &FieldDecl,
cur_proc_int: Rc<Procedure>,
cur_enumer: Option<Rc<Enumerator>>
) -> StaticSchemeRes<RustCodeItemDataType>
pub fn generate_field_data_type( &self, rust_code: &mut RustCode, field: &FieldDecl, cur_proc_int: Rc<Procedure>, cur_enumer: Option<Rc<Enumerator>> ) -> StaticSchemeRes<RustCodeItemDataType>
Generates a field’s (Rust) datatype.
Arguments
-
rust_code
- a mutable reference to RustCode instance which is used to build code. -
field
- a reference to FieldDecl with the field description from serialization information. -
cur_proc_int
- a related Procedure to the serialized data.
Returns
A SchemeResult is returned.
-
Result::Ok with the RustCodeItemDataType as inner type which contains a field data type information.
-
Result::Err with error description.
sourcepub fn clone_name(&self) -> Rc<String>
pub fn clone_name(&self) -> Rc<String>
Clones a title of the serializer.
sourcepub fn new_root_proc(&mut self, proc: Procedure) -> StaticSchemeRes<()>
pub fn new_root_proc(&mut self, proc: Procedure) -> StaticSchemeRes<()>
Declares new procedure
sourcepub fn new_proc(&mut self, proc: Procedure) -> StaticSchemeRes<()>
pub fn new_proc(&mut self, proc: Procedure) -> StaticSchemeRes<()>
Declares new procedure.
sourcepub fn symbol_define(&mut self, def: Define) -> StaticSchemeRes<()>
pub fn symbol_define(&mut self, def: Define) -> StaticSchemeRes<()>
Declares symbol.
pub fn symbol_enum_define(&mut self, def: DefineEnum) -> StaticSchemeRes<()>
sourcepub fn set_root_serialization_struct(
&mut self,
ser: Structure
) -> StaticSchemeRes<()>
pub fn set_root_serialization_struct( &mut self, ser: Structure ) -> StaticSchemeRes<()>
Sets the root serialization descriptor.
sourcepub fn add_serialization_struct(&mut self, ser: Structure)
pub fn add_serialization_struct(&mut self, ser: Structure)
Declares serialization information for structure.
sourcepub fn add_serialization_enum(&mut self, enm: Enumerator)
pub fn add_serialization_enum(&mut self, enm: Enumerator)
Declares a serialization information for enum.
sourcepub fn get_serialization_struct_by_procname(
&self,
proc_name: &String
) -> StaticSchemeRes<Rc<Structure>>
pub fn get_serialization_struct_by_procname( &self, proc_name: &String ) -> StaticSchemeRes<Rc<Structure>>
Searches for the Structure by the proc_name
which is a procedure
name.
Arguments
proc_name
- a reference to String which contains title of the procedure.
Returns
A SchemeResult with result is returned.
-
Result::Ok with reference to Structure is returned on success.
-
Result::Err with error description is returned.
pub fn get_serialization_struct_by_procname_opt( &self, proc_name: &String ) -> Option<Rc<Structure>>
pub fn get_serialization_struct_by_name( &self, struct_name: &str ) -> StaticSchemeRes<Rc<Structure>>
sourcepub fn get_serialization_enum_by_procname(
&self,
proc_name: &String
) -> SerializationPartialRes<&Enumerator>
pub fn get_serialization_enum_by_procname( &self, proc_name: &String ) -> SerializationPartialRes<&Enumerator>
Searches for the Enumerator serialization information for enum
by the procedure name
which enumerator
instance is serializing.
Arguments
proc_name
- a reference to String which points to procedure name.
Returns
A SchemeResult is returned with:
-
Result::Ok on success with the reference to Enumerator
-
Result::Err on error with the error description
pub fn get_procedure_by_name( &self, proc_name: &String ) -> Option<&Rc<Procedure>>
sourcepub fn get_root_ser(&self) -> Option<Rc<Structure>>
pub fn get_root_ser(&self) -> Option<Rc<Structure>>
Returns root serialization structure if was defined
sourcepub fn get_root_proc(&self) -> Option<Rc<Procedure>>
pub fn get_root_proc(&self) -> Option<Rc<Procedure>>
Returns root procedure.
The Rc inside Option is cloned.
sourcepub fn get_define_list_iter(&self) -> Iter<'_, Rc<String>, Rc<Define>>
pub fn get_define_list_iter(&self) -> Iter<'_, Rc<String>, Rc<Define>>
Returns iterator to defined symbols.
sourcepub fn get_enum_define_list_iter(&self) -> Iter<'_, Rc<String>, Rc<DefineEnum>>
pub fn get_enum_define_list_iter(&self) -> Iter<'_, Rc<String>, Rc<DefineEnum>>
Returns iterator to defined enum symbols.
pub fn get_enum_define_value_by_key( &self, key: &String ) -> Option<&Rc<DefineEnum>>
source§impl Serializator
impl Serializator
sourcepub fn analyze(&self) -> SerializationPartialRes<AnalyzerErrors>
pub fn analyze(&self) -> SerializationPartialRes<AnalyzerErrors>
Performs analysis of static scheme. At the moment it is able to find unused procedures and arguments.
Returns
Function returns Result as SerializationPartialRes.
-
Result::Ok with instance AnalyzerErrors is returned. This instance contains all found problems.
-
Result::Err is returned if fatal error happens.
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res =
schm.run_from_file("examples/analyzer_error/schm_init.shm", None).unwrap();
let scheme = res.get("test_auto").unwrap();
let anres = scheme.analyze().unwrap();
println!("{}", anres);
}
More examples
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/complex_example_1/init_networking.shm", None).unwrap();
let resser = res.get("networking").unwrap().clone();
let anres = resser.analyze().unwrap();
println!("errors:\n{}", anres);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/complex_example_1/init_networking_dyn1.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap();
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
}
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
fn main()
{
let curdir = std::env::current_dir().unwrap();
println!("{}", curdir.display());
let schm = init::SchemeInit::new_with_path(curdir).unwrap();
let res = schm.run_from_file("examples/another/init_l.shm", None).unwrap();
let resser = res.get("logsmon").unwrap().clone();
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
let anres = resser.analyze().unwrap();
println!("errors:\n{}", anres);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/another/data_l.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone()).unwrap();
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
/*let resser = res.get("logsmon").unwrap().clone();
let anres = resser.analyze().unwrap();
println!("errors:\n{}", anres);
let mut curdir = std::env::current_dir().unwrap();
curdir.push("examples/complex_example_1/init_networking_dyn1.shm");
let lex = lexer::Lexer::from_file(curdir).unwrap();
let dynenv = environment::DynEnvironment::new_root(resser.clone());
let dyn_res = environment::DynEnvironment::run(&lex, dynenv).unwrap();
let ret = serializator::Serialization::serialize(resser.clone(), dyn_res.clone()).unwrap();
let serialized = serde_json::to_string(&ret).unwrap();
println!("Result:\n{}", serialized);
let mut rc = RustCode::new(&["Clone", "Debug", "Serialize", "Deserialize"], &["Clone", "Debug", "Serialize", "Deserialize"]);
println!("Structures: ");
match resser.generate_rust_structs(&mut rc)
{
Ok(_) =>
{
println!("{}", rc);
},
Err(e) =>
{
println!("{}", e);
}
}
*/
}
Trait Implementations§
source§impl Clone for Serializator
impl Clone for Serializator
A dummy clone. This instance must never be clonned.