diff options
author | Lukasz Woznicki <75632179+makr11st@users.noreply.github.com> | 2021-11-24 20:54:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 20:54:56 +0000 |
commit | a4ffeccf60090e4456755bc53a6e3b8c8038e855 (patch) | |
tree | 9583f187114913a92866571920dd3bb205bd50a3 /crates/core/c8y_translator/examples/translate_to_c8yjson.rs | |
parent | 8217e80670e76dbf9168780f5e0545355a39f8f3 (diff) |
Restructure directories of the workspace (#559)
* Restructure directories of the workspace
* Rename c8y_translator_lib to c8y_translator
* Update comment on how to get dummy plugin path
Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
Diffstat (limited to 'crates/core/c8y_translator/examples/translate_to_c8yjson.rs')
-rw-r--r-- | crates/core/c8y_translator/examples/translate_to_c8yjson.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/core/c8y_translator/examples/translate_to_c8yjson.rs b/crates/core/c8y_translator/examples/translate_to_c8yjson.rs new file mode 100644 index 00000000..4bc568ce --- /dev/null +++ b/crates/core/c8y_translator/examples/translate_to_c8yjson.rs @@ -0,0 +1,27 @@ +use c8y_translator::json::from_thin_edge_json; + +fn thin_edge_translation_with_type_and_timestamp() { + let single_value_thin_edge_json_with_type_and_time = r#" { + "time" : "2013-06-22T17:03:14.100+02:00", + "temperature": 23, + "pressure": 220 + }"#; + + println!( + "\nThin_Edge_Json: \n{:#}", + single_value_thin_edge_json_with_type_and_time + ); + let output = from_thin_edge_json(single_value_thin_edge_json_with_type_and_time); + match output { + Ok(vec) => { + println!("{:?}", vec); + } + Err(e) => { + eprintln!("Error: {}", e); + } + } +} + +pub fn main() { + thin_edge_translation_with_type_and_timestamp(); +} |