dawproject_rs/api/
expression_type.rs

1#![allow(unused)]
2
3use {
4    super::fake_rng,
5    fake::{Dummy, Fake, Faker},
6    serde::{Deserialize, Serialize},
7};
8#[derive(Debug, Deserialize, Serialize, Clone, Dummy)]
9#[serde(rename = "camelCase")]
10pub enum ExpressionTypeEnum {
11    Gain,
12
13    Pan,
14
15    Transpose,
16
17    Timbre,
18
19    Formant,
20
21    Pressure,
22
23    ChannelController,
24
25    ChannelPressure,
26
27    PolyPressure,
28
29    PitchBend,
30
31    ProgramChange,
32}
33
34#[derive(Debug, Deserialize, Serialize, Clone, Dummy)]
35pub struct ExpressionType {
36    #[serde(rename = "$value", default)]
37    pub expression_type: Vec<ExpressionTypeEnum>,
38}
39
40impl ExpressionType {
41    pub fn new_test() -> Self {
42        Self {
43            expression_type: vec![],
44        }
45    }
46
47    pub fn new_fake() -> Self {
48        let o: Self = Faker.fake_with_rng(&mut fake_rng());
49        o
50    }
51}
52
53#[cfg(test)]
54mod tests {
55    use {super::ExpressionType, quick_xml::se::to_string, std::error::Error};
56
57    #[test]
58    pub fn se_test() -> Result<(), Box<dyn Error>> {
59        let mut o = ExpressionType::new_fake();
60
61        match to_string(&o) {
62            Ok(o) => println!("{}", o),
63            Err(err) => return Err(err.into()),
64        }
65
66        Ok(())
67    }
68}