diff options
author | Wavy Harp <wavyharp@gmail.com> | 2023-05-07 23:04:53 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2023-05-07 23:04:53 -0600 |
commit | 991849b32acf83dd14a5096540bb053d2572502a (patch) | |
tree | 279b59d75d4ad6081f5242cf77d843ae6b37fc3d /src/bin/test_serde.rs | |
download | rustynotes-master.zip rustynotes-master.tar.gz rustynotes-master.tar.bz2 |
currently everything is very tied to alsa and my system,
for the moment you'll need to manually change the device names
and maybe channels/period_size in src/main.rs, src/bin/smolguitar.rs
and src/bin/loopbacker.rs, i'll fix that and add runtime period
size/updater allocation soon, (and probably make a cpal backend as well
so it can work on other platforms), but doing this initial commit to play
around with stereo for now~
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 +} |