dawproject_rs/api/timeline_mods/
enum_point.rs1#![allow(unused)]
2
3use {
4 super::super::fake_rng,
5 fake::{Dummy, Fake, Faker},
6 serde::{Deserialize, Serialize},
7};
8
9#[derive(Debug, Deserialize, Serialize, Clone, Dummy)]
10pub struct EnumPoint {
11 #[serde(rename = "@time")]
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub time: Option<String>,
14 #[serde(rename = "@value")]
15 value: i32,
16}
17
18impl EnumPoint {
19 pub fn new_test() -> Self {
20 Self {
21 time: Some("empty".to_string()),
22 value: 0,
23 }
24 }
25
26 pub fn new_fake() -> Self {
27 let o: Self = Faker.fake_with_rng(&mut fake_rng());
28 o
29 }
30}
31
32#[cfg(test)]
33mod tests {
34 use std::error::Error;
35
36 use {super::EnumPoint, quick_xml::se::to_string};
37
38 #[test]
39 pub fn se_test() -> Result<(), Box<dyn Error>> {
40 let mut o = EnumPoint::new_fake();
41
42 println!("{:#?}", o);
43 match to_string(&o) {
44 Ok(o) => println!("{}", o),
45 Err(err) => return Err(err.into()),
46 }
47
48 Ok(())
49 }
50}