Crate shm_rs

Source
Expand description

A Rust crate which allows to build a configuration files based on scheme and serialize it into JSON or binary formats in order to deserialize it later. Also to autogenerate the Rust structures for desearilization dynamically during building.

See project repository for examples and description.

Re-exports§

pub extern crate bincode;
pub extern crate bitflags;
pub extern crate linked_hash_map;
pub extern crate serde;
pub extern crate serde_json;
pub use lexer::lexer::Lexer;
pub use lexer::lexer_info::LexerInfo;
pub use static_scheme::generator::RustCodeDerives;
pub use static_scheme::init::SchemeInit;
pub use static_scheme::generator::RustCode;
pub use static_scheme::error::StaticSchemeRes;
pub use static_scheme::error::StaticSchemeError;
pub use static_scheme::container::StaticSchemes;
pub use static_scheme::scheme::Serializator;
pub use static_scheme::analyzer::AnalyzerErrors;
pub use dynamic_scheme::environment::DynEnvironment;
pub use dynamic_scheme::environment::DynProcedure;
pub use dynamic_scheme::error::DynSchmRes;
pub use dynamic_scheme::error::DynSchmError;
pub use serializator::serializator::Serialization;
pub use serializator::error::SerializationErrorPartial;
pub use serializator::error::SerializationPartialRes;
pub use serializator::error::SerializationRes;
pub use serializator::error::SerializationError;
pub use crate::loader::config_cnode::CNode;
pub use crate::loader::config_loader_local::ConfigLocaFileSystem;
pub use crate::loader::config_loader::ConfigInitSource;
pub use crate::loader::config_loader::ConfigLoader;
pub use crate::loader::config_collector::ConfigCollector;

Modules§

common
dynamic_scheme
error
lexer
loader
scheme_composer
serializator
static_scheme

Macros§

comp_throw_scmp
comp_throw_text
lex_err
lex_err1
lex_iter_err
map_comp_throw_scmp
map_comp_throw_text
map_dyn_nr
map_into_dyn_throw_li
map_into_dyn_throw_msg
map_lex_err
map_lex_err1
map_new_static_throw_text
map_root
map_ser_partial_throw
map_serial_throw_add
map_serial_throw_all
map_static_nr
map_static_root
ret_dyn_nr
ret_static_nr
ser_partial_throw
serial_throw_all
serial_throw_li
serial_throw_text
static_throw_text

Functions§

collect_config
Prepares the instance of the collector of config file. It is based on the CNode storage. However, if a custom storage mechanism is required, for example (zip) then implement a trait in your program.
deserialize
Performs deserialization of the data into the type S from the JSON.
dynamic_scheme_file_single
A dynamic scheme file parsing based on the description from the statis scheme.
load_config
Prepares the config loader from local file system and performing setup of environment from static_cfg_source - ConfigInitSource.
rustcode_generate
Generates a Rust code from the serializator (a static scheme). This is a simple realizaton. For compels, see examples.
serialize
Performs serialization of the data in DynProcedure instance according to the description in Serializator instance. And then the result is serialized as JSON and returnd as String.
static_scheme_analyze
Calls scheme analyzer to find any unused items or incorrect path references.
static_scheme_init
Initializes a SchemeInit instance. This is usefull when it is required to perform some custom actions and reuse instance.
static_scheme_init_basepath
Initializes a SchemeInit instance with the basepath which is a path to the root directory where usually an init.shm fle is located.
static_scheme_init_multiple
Reads multiple files which contains a description of the serializator in single StaticSchemes instance. If you have some init.shm which includes other files, then use static_scheme_init_multiple.
static_scheme_init_single
Reads a single file which contains a description of the serializator. If you have some init.shm which includes other files, then use static_scheme_init_multiple.
static_scheme_run
Initializes a SchemeInit instance with the basepath which is a path to the root directory where usually an init.shm fle is located and an init.shm file relative location.
store_file
A helper function which could be used to store the config file in the ConfigCollector.
store_raw_file
A helper function which could be used to store the text file in the ConfigCollector.