diff options
Diffstat (limited to 'src/bin/test_serde.rs')
-rw-r--r-- | src/bin/test_serde.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bin/test_serde.rs b/src/bin/test_serde.rs new file mode 100644 index 0000000..02b42e4 --- /dev/null +++ b/src/bin/test_serde.rs @@ -0,0 +1,22 @@ +use crossterm::style::Color; +use serde::{Serialize, Deserialize}; +use serde_json::{to_string_pretty, from_str}; + +#[derive(Serialize, Deserialize, Debug)] +struct cscheme { + a: Color, + asharp: Color, + b: Color, +} + +fn main() { + let val = Color::Rgb {r: 110, g: 255, b: 220}; + let val2 = Color::AnsiValue(51); + let val3 = Color::DarkMagenta; + let scheme = cscheme {a: val, asharp: val2, b: val3}; + let json = to_string_pretty(&scheme).unwrap(); + println!("{}", json); + let result: cscheme = from_str(&json).unwrap(); + println!("{:?}", result); + //println!("{} {}", to_string_pretty +} |