To save Array contents, shape in JSON format, it just takes couple of lines of code as shown below:
{{#include ../../src/core/array.rs:array_json_serde_snippet}}
Saving Array in different formats is as simple as changing the object qualifier of methods serialize
and deserialize
. For example, if user wants to store Array in bincode
format instead of JSON, the above code only needs to be change in couple of lines.
{{#include ../../src/core/array.rs:array_bincode_serde_snippet}}
In similar fashion, we can serialize and deserialize Dim4, RandomEngine, Seq and other Enums. Examples of Dim4, RandomEngine and Seq are given below.
{{#include ../../src/core/dim4.rs:dim4_json_serde_snippet}}
{{#include ../../src/core/random.rs:rng_bincode_serde_snippet}}
{{#include ../../src/core/seq.rs:seq_json_serde_snippet}}