I'm getting an error
for the following:
#[derive(Default, Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
#[yaserde(root = "layout")]
pub struct Layout {
#[yaserde(attribute)]
pub version: u32,
#[yaserde(attribute)]
pub mode: u32,
#[yaserde(attribute)]
pub w: u32,
#[yaserde(attribute)]
pub h: u32,
#[yaserde(attribute)]
pub orientation: Orientation,
pub tabpage: Tabpage,
}
#[derive(Default, Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
pub struct Tabpage {
#[yaserde(attribute)]
pub name: String,
#[yaserde(attribute)]
pub scalef: f32,
#[yaserde(attribute)]
pub scalet: f32,
#[yaserde(attribute)]
pub li_t: String,
#[yaserde(attribute)]
pub li_c: String,
#[yaserde(attribute)]
pub li_s: String,
#[yaserde(attribute)]
pub li_o: String,
#[yaserde(attribute)]
pub li_b: String,
#[yaserde(attribute)]
pub la_t: String,
#[yaserde(attribute)]
pub la_c: String,
#[yaserde(attribute)]
pub la_s: String,
#[yaserde(attribute)]
pub la_o: String,
#[yaserde(attribute)]
pub la_b: String,
pub control: Vec<Control>,
}
#[derive(Default, Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
pub struct Control {
#[yaserde(attribute)]
pub name: String,
#[yaserde(attribute)]
pub x: u32,
#[yaserde(attribute)]
pub y: u32,
#[yaserde(attribute)]
pub w: u32,
#[yaserde(attribute)]
pub h: u32,
#[yaserde(attribute)]
pub color: String,
#[yaserde(attribute)]
pub scalef: f32,
#[yaserde(attribute)]
pub scalet: f32,
#[yaserde(attribute)]
pub local_off: Option<bool>,
#[yaserde(attribute)]
pub sp: Option<String>,
#[yaserde(attribute)]
pub sr: Option<String>,
pub midi: Option<Midi>,
#[yaserde(attribute)]
pub response: Option<Response>,
#[yaserde(attribute)]
pub inverted: Option<bool>,
#[yaserde(attribute)]
pub centered: Option<bool>,
#[yaserde(attribute)]
pub norollover: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
pub enum Response { absolute, relative }
#[derive(Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
pub enum Orientation { vertical, horizontal }
#[derive(Default, Debug, Clone, PartialEq, YaSerialize, YaDeserialize)]
pub struct Midi {
#[yaserde(attribute)]
pub var: String,
#[yaserde(attribute)]
#[yaserde(rename = "type")]
pub typ: String,
#[yaserde(attribute)]
pub channel: u8,
#[yaserde(attribute)]
pub data1: u8,
#[yaserde(attribute)]
pub data2f: u8,
#[yaserde(attribute)]
pub data2t: u8,
#[yaserde(attribute)]
pub sysex: String,
}
wrong number of type arguments: expected 1, found 0
expected 1 type argument
Btw, my goal is to serialize xml docs in this format:
<?xml version="1.0" encoding="UTF-8"?>
<layout version="16" mode="3" w="460" h="736" orientation="vertical">
<tabpage name="MQ==" scalef="0.0" scalet="1.0" li_t="" li_c="gray" li_s="14" li_o="false" li_b="false" la_t="" la_c="gray" la_s="14" la_o="false" la_b="false">
<control name="cHVzaDI1" x="114" y="680" w="45" h="45" color="red" scalef="0.0" scalet="1.0" type="push" local_off="false" sp="true" sr="true">
<midi var="x" type="1" channel="1" data1="25" data2f="0" data2t="127" sysex="" />
</control>
<control name="cm90YXJ5MA==" x="14" y="569" w="100" h="100" color="red" scalef="0.0" scalet="1.0" type="rotaryh" response="absolute" inverted="false" centered="false" norollover="true">
<midi var="x" type="0" channel="1" data1="0" data2f="0" data2t="127" sysex="" />
</control>
<control name="ZmFkZXIz" x="0" y="151" w="120" h="40" color="blue" scalef="0.0" scalet="1.0" type="faderh" response="relative" inverted="false" centered="false" />
</tabpage>
</layout>
How can I do this with yaserde? :)