improve contribution to add examples, fix some clippy warns
This commit is contained in:
parent
a65fa84f75
commit
6492efcfdc
@ -2,5 +2,5 @@
|
|||||||
members = [
|
members = [
|
||||||
"yaserde",
|
"yaserde",
|
||||||
"yaserde_derive",
|
"yaserde_derive",
|
||||||
# "examples"
|
"examples",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -3,10 +3,11 @@ name = "yaserde-examples"
|
|||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Marc-Antoine Arnaud <maarnaud@media-io.com>"]
|
authors = ["Marc-Antoine Arnaud <maarnaud@media-io.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
yaserde = {version = "0.5.1", path = "../../yaserde" }
|
yaserde = {version = "0.5.1", path = "../yaserde" }
|
||||||
yaserde_derive = {version = "0.5.1", path = "../../yaserde_derive" }
|
yaserde_derive = {version = "0.5.1", path = "../yaserde_derive" }
|
||||||
xml-rs = "0.8.0"
|
xml-rs = "0.8.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
simple_logger = "1.0"
|
simple_logger = "1.0"
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
// related to issue https://github.com/media-io/yaserde/issues/15
|
// related to issue https://github.com/media-io/yaserde/issues/15
|
||||||
use std::io::Read;
|
|
||||||
use yaserde::YaDeserialize;
|
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
#[yaserde(
|
#[yaserde(
|
||||||
prefix="ss",
|
prefix = "ss",
|
||||||
namespace="x: urn:schemas-microsoft-com:office:excel",
|
namespace = "x: urn:schemas-microsoft-com:office:excel",
|
||||||
namespace="ss: urn:schemas-microsoft-com:office:spreadsheet",
|
namespace = "ss: urn:schemas-microsoft-com:office:spreadsheet",
|
||||||
namespace="o: urn:schemas-microsoft-com:office:office",
|
namespace = "o: urn:schemas-microsoft-com:office:office",
|
||||||
namespace="html: http://www.w3.org/TR/REC-html40"
|
namespace = "html: http://www.w3.org/TR/REC-html40"
|
||||||
)]
|
)]
|
||||||
struct Workbook {
|
struct Workbook {
|
||||||
#[yaserde(rename = "Worksheet")]
|
#[yaserde(rename = "Worksheet")]
|
||||||
@ -17,11 +15,11 @@ struct Workbook {
|
|||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
#[yaserde(
|
#[yaserde(
|
||||||
prefix="ss",
|
prefix = "ss",
|
||||||
namespace="x: urn:schemas-microsoft-com:office:excel",
|
namespace = "x: urn:schemas-microsoft-com:office:excel",
|
||||||
namespace="ss: urn:schemas-microsoft-com:office:spreadsheet",
|
namespace = "ss: urn:schemas-microsoft-com:office:spreadsheet",
|
||||||
namespace="o: urn:schemas-microsoft-com:office:office",
|
namespace = "o: urn:schemas-microsoft-com:office:office",
|
||||||
namespace="html: http://www.w3.org/TR/REC-html40"
|
namespace = "html: http://www.w3.org/TR/REC-html40"
|
||||||
)]
|
)]
|
||||||
struct Worksheet {
|
struct Worksheet {
|
||||||
#[yaserde(rename = "Table")]
|
#[yaserde(rename = "Table")]
|
||||||
@ -32,11 +30,11 @@ struct Worksheet {
|
|||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
#[yaserde(
|
#[yaserde(
|
||||||
prefix="ss",
|
prefix = "ss",
|
||||||
namespace="x: urn:schemas-microsoft-com:office:excel",
|
namespace = "x: urn:schemas-microsoft-com:office:excel",
|
||||||
namespace="ss: urn:schemas-microsoft-com:office:spreadsheet",
|
namespace = "ss: urn:schemas-microsoft-com:office:spreadsheet",
|
||||||
namespace="o: urn:schemas-microsoft-com:office:office",
|
namespace = "o: urn:schemas-microsoft-com:office:office",
|
||||||
namespace="html: http://www.w3.org/TR/REC-html40"
|
namespace = "html: http://www.w3.org/TR/REC-html40"
|
||||||
)]
|
)]
|
||||||
struct Table {
|
struct Table {
|
||||||
#[yaserde(attribute, rename = "ExpandedColumnCount", prefix = "ss")]
|
#[yaserde(attribute, rename = "ExpandedColumnCount", prefix = "ss")]
|
||||||
@ -55,17 +53,16 @@ struct Table {
|
|||||||
default_column_height: f32,
|
default_column_height: f32,
|
||||||
|
|
||||||
#[yaserde(rename = "Row")]
|
#[yaserde(rename = "Row")]
|
||||||
rows: Vec<Row>
|
rows: Vec<Row>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
#[yaserde(
|
#[yaserde(
|
||||||
prefix="ss",
|
prefix = "ss",
|
||||||
namespace="x: urn:schemas-microsoft-com:office:excel",
|
namespace = "x: urn:schemas-microsoft-com:office:excel",
|
||||||
namespace="ss: urn:schemas-microsoft-com:office:spreadsheet",
|
namespace = "ss: urn:schemas-microsoft-com:office:spreadsheet",
|
||||||
namespace="o: urn:schemas-microsoft-com:office:office",
|
namespace = "o: urn:schemas-microsoft-com:office:office",
|
||||||
namespace="html: http://www.w3.org/TR/REC-html40"
|
namespace = "html: http://www.w3.org/TR/REC-html40"
|
||||||
)]
|
)]
|
||||||
struct Row {
|
struct Row {
|
||||||
#[yaserde(attribute, rename = "AutoFitHeight", prefix = "ss")]
|
#[yaserde(attribute, rename = "AutoFitHeight", prefix = "ss")]
|
||||||
@ -76,17 +73,14 @@ struct Row {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parsing_bbigras_namespace() {
|
fn parsing_bbigras_namespace() {
|
||||||
use std::fs::File;
|
use std::fs;
|
||||||
use yaserde::de::from_str;
|
use yaserde::de::from_str;
|
||||||
|
|
||||||
let filename = "tests/data/bbigras-namespace.xml";
|
let filename = "tests/data/bbigras-namespace.xml";
|
||||||
let mut f = File::open(filename).expect("file not found");
|
|
||||||
|
|
||||||
let mut contents = String::new();
|
let content = fs::read_to_string(filename).expect("something went wrong reading the file");
|
||||||
f.read_to_string(&mut contents)
|
|
||||||
.expect("something went wrong reading the file");
|
|
||||||
|
|
||||||
let loaded: Workbook = from_str(&contents).unwrap();
|
let loaded: Workbook = from_str(&content).unwrap();
|
||||||
println!("{:?}", loaded);
|
println!("{:?}", loaded);
|
||||||
|
|
||||||
let reference = Workbook {
|
let reference = Workbook {
|
||||||
@ -100,11 +94,12 @@ fn parsing_bbigras_namespace() {
|
|||||||
style_id: "s64".to_string(),
|
style_id: "s64".to_string(),
|
||||||
default_column_width: 60.75,
|
default_column_width: 60.75,
|
||||||
default_column_height: 15.0,
|
default_column_height: 15.0,
|
||||||
rows: vec![
|
rows: vec![Row {
|
||||||
Row { auto_fit_height: 0.0, height: 33.0 }
|
auto_fit_height: 0.0,
|
||||||
]
|
height: 33.0,
|
||||||
}
|
}],
|
||||||
}
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(loaded, reference);
|
assert_eq!(loaded, reference);
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
// related to issue https://github.com/media-io/yaserde/issues/3
|
// related to issue https://github.com/media-io/yaserde/issues/3
|
||||||
use std::io::Read;
|
|
||||||
use yaserde::YaDeserialize;
|
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, YaDeserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, YaDeserialize)]
|
||||||
#[yaserde(root = "layout")]
|
#[yaserde(root = "layout")]
|
||||||
@ -104,17 +102,13 @@ pub struct Midi {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parsing_bbigras_namespace() {
|
fn parsing_bbigras_namespace() {
|
||||||
use std::fs::File;
|
use std::fs;
|
||||||
use yaserde::de::from_str;
|
use yaserde::de::from_str;
|
||||||
|
|
||||||
let filename = "tests/data/boscop.xml";
|
let filename = "tests/data/boscop.xml";
|
||||||
let mut f = File::open(filename).expect("file not found");
|
let content = fs::read_to_string(filename).expect("something went wrong reading the file");
|
||||||
|
|
||||||
let mut contents = String::new();
|
let loaded: Layout = from_str(&content).unwrap();
|
||||||
f.read_to_string(&mut contents)
|
|
||||||
.expect("something went wrong reading the file");
|
|
||||||
|
|
||||||
let loaded: Layout = from_str(&contents).unwrap();
|
|
||||||
|
|
||||||
assert_eq!(loaded.tabpage.len(), 4);
|
assert_eq!(loaded.tabpage.len(), 4);
|
||||||
assert_eq!(loaded.tabpage[0].control.len(), 13);
|
assert_eq!(loaded.tabpage[0].control.len(), 13);
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
extern crate log;
|
|
||||||
extern crate simple_logger;
|
|
||||||
extern crate xml;
|
|
||||||
extern crate yaserde;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate yaserde_derive;
|
extern crate yaserde_derive;
|
||||||
|
|
||||||
mod bbigras_namespace;
|
mod bbigras_namespace;
|
||||||
mod boscop;
|
mod boscop;
|
||||||
mod ln_dom;
|
mod ln_dom;
|
||||||
|
mod svd;
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
// related to issue https://github.com/media-io/yaserde/issues/11
|
// related to issue https://github.com/media-io/yaserde/issues/11
|
||||||
use std::io::Read;
|
|
||||||
use yaserde::YaDeserialize;
|
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
#[yaserde(root="DOMSymbolItem")]
|
#[yaserde(root = "DOMSymbolItem")]
|
||||||
struct Level {
|
struct Level {
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
last_modified: u64,
|
last_modified: u64,
|
||||||
@ -15,7 +13,7 @@ struct Level {
|
|||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
struct Timeline {
|
struct Timeline {
|
||||||
#[yaserde(rename = "DOMTimeline")]
|
#[yaserde(rename = "DOMTimeline")]
|
||||||
timeline: DOMTimeline
|
timeline: DOMTimeline,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
@ -26,13 +24,13 @@ struct DOMTimeline {
|
|||||||
current_frame: u64,
|
current_frame: u64,
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
guides: u64,
|
guides: u64,
|
||||||
layers: Layers
|
layers: Layers,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
struct Layers {
|
struct Layers {
|
||||||
#[yaserde(rename = "DOMLayer")]
|
#[yaserde(rename = "DOMLayer")]
|
||||||
dom_layer: Vec<DOMLayer>
|
dom_layer: Vec<DOMLayer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
#[derive(YaDeserialize, Default, Debug, PartialEq)]
|
||||||
@ -40,22 +38,19 @@ struct DOMLayer {
|
|||||||
#[yaserde(attribute, rename = "name")]
|
#[yaserde(attribute, rename = "name")]
|
||||||
named: String,
|
named: String,
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
name2: String
|
name2: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parsing_ln_dom() {
|
fn parsing_ln_dom() {
|
||||||
use std::fs::File;
|
use std::fs;
|
||||||
use yaserde::de::from_str;
|
use yaserde::de::from_str;
|
||||||
|
|
||||||
let filename = "tests/data/ln-dom.xml";
|
let filename = "tests/data/ln-dom.xml";
|
||||||
let mut f = File::open(filename).expect("file not found");
|
|
||||||
|
|
||||||
let mut contents = String::new();
|
let content = fs::read_to_string(filename).expect("something went wrong reading the file");
|
||||||
f.read_to_string(&mut contents)
|
|
||||||
.expect("something went wrong reading the file");
|
|
||||||
|
|
||||||
let loaded: Level = from_str(&contents).unwrap();
|
let loaded: Level = from_str(&content).unwrap();
|
||||||
println!("{:?}", loaded);
|
println!("{:?}", loaded);
|
||||||
|
|
||||||
let reference = Level {
|
let reference = Level {
|
||||||
@ -70,16 +65,16 @@ fn parsing_ln_dom() {
|
|||||||
dom_layer: vec![
|
dom_layer: vec![
|
||||||
DOMLayer {
|
DOMLayer {
|
||||||
named: "Layer 2".to_string(),
|
named: "Layer 2".to_string(),
|
||||||
name2: "Lalayer 2".to_string()
|
name2: "Lalayer 2".to_string(),
|
||||||
},
|
},
|
||||||
DOMLayer {
|
DOMLayer {
|
||||||
named: "Layer 1".to_string(),
|
named: "Layer 1".to_string(),
|
||||||
name2: "Lalayer 1".to_string()
|
name2: "Lalayer 1".to_string(),
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
assert_eq!(loaded, reference);
|
assert_eq!(loaded, reference);
|
||||||
|
|||||||
@ -2,127 +2,125 @@ use yaserde_derive::YaSerialize;
|
|||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
struct CpuDef {
|
struct CpuDef {
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
name: String,
|
name: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
revision: String,
|
revision: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
endian: String, // enum {LE, BE, ME}
|
endian: String, // enum {LE, BE, ME}
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
mpupresent: bool,
|
mpupresent: bool,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
fpupresent: bool,
|
fpupresent: bool,
|
||||||
//#[yaserde(child)]
|
//#[yaserde(child)]
|
||||||
//nvicpriobits: enum {8, 16, 32, 64, 128},
|
//nvicpriobits: enum {8, 16, 32, 64, 128},
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
vendorsystickconfig: bool
|
vendorsystickconfig: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
struct Field {
|
struct Field {
|
||||||
name: String,
|
name: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
description: String,
|
description: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
bitrange: String,
|
bitrange: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
access: String,
|
access: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
struct Register {
|
struct Register {
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
name: String,
|
name: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
description: String,
|
description: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
addressoffset: String,
|
addressoffset: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
size: u8,
|
size: u8,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
access: String,
|
access: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
resetvalue: String,
|
resetvalue: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
resetmask: String,
|
resetmask: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
fields: Vec<Field>
|
fields: Vec<Field>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
struct Peripheral {
|
struct Peripheral {
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
name: String,
|
name: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
version: String,
|
version: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
description: String,
|
description: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
groupname: String,
|
groupname: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
baseaddress: String,
|
baseaddress: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
size: u8,
|
size: u8,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
access: String,
|
access: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
registers: Vec<Register>
|
registers: Vec<Register>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
struct DevAttrs {
|
struct DevAttrs {
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
vendor: String,
|
vendor: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
vendorid: String,
|
vendorid: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
name: String,
|
name: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
series: String,
|
series: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
version: String,
|
version: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
description: String,
|
description: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
licensetext: String,
|
licensetext: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
cpu: CpuDef,
|
cpu: CpuDef,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
addressunitbits: u8,
|
addressunitbits: u8,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
width: u8,
|
width: u8,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
size: u8,
|
size: u8,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
access: String,
|
access: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
resetvalue: String,
|
resetvalue: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
resetmask: String,
|
resetmask: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
peripherals: Vec<Peripheral>
|
peripherals: Vec<Peripheral>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
#[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
#[yaserde(rename = "device")]
|
#[yaserde(rename = "device")]
|
||||||
struct Device {
|
struct Device {
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
schemaversion: String,
|
schemaversion: String,
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
xmlns: String,
|
xmlns: String,
|
||||||
#[yaserde(attribute)]
|
#[yaserde(attribute)]
|
||||||
xsnonamespaceschemalocation: String,
|
xsnonamespaceschemalocation: String,
|
||||||
#[yaserde(child)]
|
#[yaserde(child)]
|
||||||
devattributes: DevAttrs
|
devattributes: DevAttrs,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
#[test]
|
||||||
|
fn parsing_svd() {
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
let mut vec_peripherals: Vec<Peripheral> = Vec::new();
|
let register = Register {
|
||||||
let mut vec_registers: Vec<Register> = Vec::new();
|
|
||||||
let vec_fields: Vec<Field> = Vec::new();
|
|
||||||
|
|
||||||
let register = Register {
|
|
||||||
name: "PRCMD".to_string(),
|
name: "PRCMD".to_string(),
|
||||||
description: "This command register (PRCMD) is to protect the registers that may have a significant influence on the application system (PSC, PSM) from an inadvertent write access, so that the system does not stop in case of a program hang-up.".to_string(),
|
description: "This command register (PRCMD) is to protect the registers that may have a significant influence on the application system (PSC, PSM) from an inadvertent write access, so that the system does not stop in case of a program hang-up.".to_string(),
|
||||||
addressoffset: "0xFFFFF1FC".to_string(),
|
addressoffset: "0xFFFFF1FC".to_string(),
|
||||||
@ -130,60 +128,69 @@ fn main() {
|
|||||||
access: "read-write".to_string(),
|
access: "read-write".to_string(),
|
||||||
resetvalue: "0x0000".to_string(),
|
resetvalue: "0x0000".to_string(),
|
||||||
resetmask: "0xFFFF".to_string(),
|
resetmask: "0xFFFF".to_string(),
|
||||||
fields: vec_fields
|
fields: vec![],
|
||||||
};
|
|
||||||
vec_registers.push(register);
|
|
||||||
|
|
||||||
let peripheral = Peripheral {
|
|
||||||
name: "Specific Registers".to_string(),
|
|
||||||
version: "1.0".to_string(),
|
|
||||||
description: "Specific Registers".to_string(),
|
|
||||||
groupname: "MCU".to_string(),
|
|
||||||
baseaddress: "0xFFFFF1FC".to_string(),
|
|
||||||
size: 16,
|
|
||||||
access: "read-write".to_string(),
|
|
||||||
registers: vec_registers
|
|
||||||
};
|
|
||||||
vec_peripherals.push(peripheral);
|
|
||||||
|
|
||||||
let cpu_def = CpuDef {
|
|
||||||
name: "V850".to_string(),
|
|
||||||
revision: "r1".to_string(),
|
|
||||||
endian: "LE".to_string(), // enum {LE, BE, ME}
|
|
||||||
mpupresent: false,
|
|
||||||
fpupresent: false,
|
|
||||||
//nvicpriobits: enum {8, 16, 32, 64, 128},
|
|
||||||
vendorsystickconfig: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let dev_attrs = DevAttrs {
|
let vec_registers = vec![register];
|
||||||
vendor: "Renesas".to_string(),
|
|
||||||
vendorid: "Renesas".to_string(),
|
|
||||||
name: "V850".to_string(),
|
|
||||||
series: "E1/E2/CA2".to_string(),
|
|
||||||
version: "1.2".to_string(),
|
|
||||||
description: "NEC/Renesas V850 automotive grade ICs".to_string(),
|
|
||||||
licensetext: "GPLv3".to_string(),
|
|
||||||
cpu: cpu_def,
|
|
||||||
addressunitbits: 8,
|
|
||||||
width: 32,
|
|
||||||
size: 32,
|
|
||||||
access: "read-write".to_string(),
|
|
||||||
resetvalue: "0x00000000".to_string(),
|
|
||||||
resetmask: "0xFFFFFFFF".to_string(),
|
|
||||||
peripherals: vec_peripherals
|
|
||||||
};
|
|
||||||
|
|
||||||
let dev = Device { schemaversion: "foo".to_string(),
|
let peripheral = Peripheral {
|
||||||
xmlns: "http://www.w3.org/2001/XMLSchema-instance".to_string(),
|
name: "Specific Registers".to_string(),
|
||||||
xsnonamespaceschemalocation: "CMSIS-SVD.xsd".to_string(),
|
version: "1.0".to_string(),
|
||||||
devattributes: dev_attrs
|
description: "Specific Registers".to_string(),
|
||||||
};
|
groupname: "MCU".to_string(),
|
||||||
|
baseaddress: "0xFFFFF1FC".to_string(),
|
||||||
// Display pretty printed XML
|
size: 16,
|
||||||
let yaserde_cfg = yaserde::ser::Config{
|
access: "read-write".to_string(),
|
||||||
perform_indent: true,
|
registers: vec_registers,
|
||||||
.. Default::default()
|
};
|
||||||
};
|
|
||||||
println!("{:#?}", yaserde::ser::to_string_with_config(&dev, &yaserde_cfg));
|
let vec_peripherals = vec![peripheral];
|
||||||
|
|
||||||
|
let cpu_def = CpuDef {
|
||||||
|
name: "V850".to_string(),
|
||||||
|
revision: "r1".to_string(),
|
||||||
|
endian: "LE".to_string(), // enum {LE, BE, ME}
|
||||||
|
mpupresent: false,
|
||||||
|
fpupresent: false,
|
||||||
|
//nvicpriobits: enum {8, 16, 32, 64, 128},
|
||||||
|
vendorsystickconfig: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let dev_attrs = DevAttrs {
|
||||||
|
vendor: "Renesas".to_string(),
|
||||||
|
vendorid: "Renesas".to_string(),
|
||||||
|
name: "V850".to_string(),
|
||||||
|
series: "E1/E2/CA2".to_string(),
|
||||||
|
version: "1.2".to_string(),
|
||||||
|
description: "NEC/Renesas V850 automotive grade ICs".to_string(),
|
||||||
|
licensetext: "GPLv3".to_string(),
|
||||||
|
cpu: cpu_def,
|
||||||
|
addressunitbits: 8,
|
||||||
|
width: 32,
|
||||||
|
size: 32,
|
||||||
|
access: "read-write".to_string(),
|
||||||
|
resetvalue: "0x00000000".to_string(),
|
||||||
|
resetmask: "0xFFFFFFFF".to_string(),
|
||||||
|
peripherals: vec_peripherals,
|
||||||
|
};
|
||||||
|
|
||||||
|
let device = Device {
|
||||||
|
schemaversion: "foo".to_string(),
|
||||||
|
xmlns: "http://www.w3.org/2001/XMLSchema-instance".to_string(),
|
||||||
|
xsnonamespaceschemalocation: "CMSIS-SVD.xsd".to_string(),
|
||||||
|
devattributes: dev_attrs,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Display pretty printed XML
|
||||||
|
let yaserde_cfg = yaserde::ser::Config {
|
||||||
|
perform_indent: true,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
|
let serialized = yaserde::ser::to_string_with_config(&device, &yaserde_cfg).unwrap();
|
||||||
|
|
||||||
|
let reference =
|
||||||
|
fs::read_to_string("tests/data/svd.xml").expect("something went wrong reading the file");
|
||||||
|
|
||||||
|
assert_eq!(reference, serialized)
|
||||||
}
|
}
|
||||||
|
|||||||
44
examples/tests/data/svd.xml
Normal file
44
examples/tests/data/svd.xml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<device schemaversion="foo" xmlns="http://www.w3.org/2001/XMLSchema-instance" xsnonamespaceschemalocation="CMSIS-SVD.xsd">
|
||||||
|
<devattributes>
|
||||||
|
<vendor>Renesas</vendor>
|
||||||
|
<vendorid>Renesas</vendorid>
|
||||||
|
<name>V850</name>
|
||||||
|
<series>E1/E2/CA2</series>
|
||||||
|
<version>1.2</version>
|
||||||
|
<description>NEC/Renesas V850 automotive grade ICs</description>
|
||||||
|
<licensetext>GPLv3</licensetext>
|
||||||
|
<cpu>
|
||||||
|
<name>V850</name>
|
||||||
|
<revision>r1</revision>
|
||||||
|
<endian>LE</endian>
|
||||||
|
<mpupresent>false</mpupresent>
|
||||||
|
<fpupresent>false</fpupresent>
|
||||||
|
<vendorsystickconfig>false</vendorsystickconfig>
|
||||||
|
</cpu>
|
||||||
|
<addressunitbits>8</addressunitbits>
|
||||||
|
<width>32</width>
|
||||||
|
<size>32</size>
|
||||||
|
<access>read-write</access>
|
||||||
|
<resetvalue>0x00000000</resetvalue>
|
||||||
|
<resetmask>0xFFFFFFFF</resetmask>
|
||||||
|
<peripherals>
|
||||||
|
<name>Specific Registers</name>
|
||||||
|
<version>1.0</version>
|
||||||
|
<description>Specific Registers</description>
|
||||||
|
<groupname>MCU</groupname>
|
||||||
|
<baseaddress>0xFFFFF1FC</baseaddress>
|
||||||
|
<size>16</size>
|
||||||
|
<access>read-write</access>
|
||||||
|
<registers>
|
||||||
|
<name>PRCMD</name>
|
||||||
|
<description>This command register (PRCMD) is to protect the registers that may have a significant influence on the application system (PSC, PSM) from an inadvertent write access, so that the system does not stop in case of a program hang-up.</description>
|
||||||
|
<addressoffset>0xFFFFF1FC</addressoffset>
|
||||||
|
<size>8</size>
|
||||||
|
<access>read-write</access>
|
||||||
|
<resetvalue>0x0000</resetvalue>
|
||||||
|
<resetmask>0xFFFF</resetmask>
|
||||||
|
</registers>
|
||||||
|
</peripherals>
|
||||||
|
</devattributes>
|
||||||
|
</device>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
//! file for microcontrollers is called [SVD](https://github.com/rust-embedded/svd/)
|
//! file for microcontrollers is called [SVD](https://github.com/rust-embedded/svd/)
|
||||||
//! and it can be defined on YaSerDe via structs like so:
|
//! and it can be defined on YaSerDe via structs like so:
|
||||||
//!
|
//!
|
||||||
//!```ignore
|
//!```rust
|
||||||
//! use yaserde_derive::YaSerialize;
|
//! use yaserde_derive::YaSerialize;
|
||||||
//!
|
//!
|
||||||
//! #[derive(Default, PartialEq, Debug, YaSerialize)]
|
//! #[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
@ -26,7 +26,13 @@
|
|||||||
//! #[yaserde(attribute)]
|
//! #[yaserde(attribute)]
|
||||||
//! xsnonamespaceschemalocation: String,
|
//! xsnonamespaceschemalocation: String,
|
||||||
//! #[yaserde(child)]
|
//! #[yaserde(child)]
|
||||||
//! devattributes: DevAttrs
|
//! attributes: DeviceAttributes
|
||||||
|
//! }
|
||||||
|
//!
|
||||||
|
//! #[derive(Default, PartialEq, Debug, YaSerialize)]
|
||||||
|
//! struct DeviceAttributes {
|
||||||
|
//! #[yaserde(child)]
|
||||||
|
//! vendor: String,
|
||||||
//! }
|
//! }
|
||||||
//!```
|
//!```
|
||||||
//!
|
//!
|
||||||
|
|||||||
@ -15,29 +15,29 @@ fn basic_option_types() {
|
|||||||
test_for_type!(Option::<String>, None, None);
|
test_for_type!(Option::<String>, None, None);
|
||||||
test_for_type!(Option::<bool>, Some(true), Some("true"));
|
test_for_type!(Option::<bool>, Some(true), Some("true"));
|
||||||
test_for_type!(Option::<bool>, None, None);
|
test_for_type!(Option::<bool>, None, None);
|
||||||
test_for_type!(Option::<u8>, Some(12 as u8), Some("12"));
|
test_for_type!(Option::<u8>, Some(12_u8), Some("12"));
|
||||||
test_for_type!(Option::<u8>, None, None);
|
test_for_type!(Option::<u8>, None, None);
|
||||||
test_for_type!(Option::<i8>, Some(12 as i8), Some("12"));
|
test_for_type!(Option::<i8>, Some(12_i8), Some("12"));
|
||||||
test_for_type!(Option::<i8>, Some(-12 as i8), Some("-12"));
|
test_for_type!(Option::<i8>, Some(-12_i8), Some("-12"));
|
||||||
test_for_type!(Option::<i8>, None, None);
|
test_for_type!(Option::<i8>, None, None);
|
||||||
test_for_type!(Option::<u16>, Some(12 as u16), Some("12"));
|
test_for_type!(Option::<u16>, Some(12_u16), Some("12"));
|
||||||
test_for_type!(Option::<u16>, None, None);
|
test_for_type!(Option::<u16>, None, None);
|
||||||
test_for_type!(Option::<i16>, Some(12 as i16), Some("12"));
|
test_for_type!(Option::<i16>, Some(12_i16), Some("12"));
|
||||||
test_for_type!(Option::<i16>, Some(-12 as i16), Some("-12"));
|
test_for_type!(Option::<i16>, Some(-12_i16), Some("-12"));
|
||||||
test_for_type!(Option::<i16>, None, None);
|
test_for_type!(Option::<i16>, None, None);
|
||||||
test_for_type!(Option::<u32>, Some(12 as u32), Some("12"));
|
test_for_type!(Option::<u32>, Some(12_u32), Some("12"));
|
||||||
test_for_type!(Option::<u32>, None, None);
|
test_for_type!(Option::<u32>, None, None);
|
||||||
test_for_type!(Option::<i32>, Some(12 as i32), Some("12"));
|
test_for_type!(Option::<i32>, Some(12_i32), Some("12"));
|
||||||
test_for_type!(Option::<i32>, Some(-12 as i32), Some("-12"));
|
test_for_type!(Option::<i32>, Some(-12_i32), Some("-12"));
|
||||||
test_for_type!(Option::<i32>, None, None);
|
test_for_type!(Option::<i32>, None, None);
|
||||||
test_for_type!(Option::<u64>, Some(12 as u64), Some("12"));
|
test_for_type!(Option::<u64>, Some(12_u64), Some("12"));
|
||||||
test_for_type!(Option::<u64>, None, None);
|
test_for_type!(Option::<u64>, None, None);
|
||||||
test_for_type!(Option::<i64>, Some(12 as i64), Some("12"));
|
test_for_type!(Option::<i64>, Some(12_i64), Some("12"));
|
||||||
test_for_type!(Option::<i64>, Some(-12 as i64), Some("-12"));
|
test_for_type!(Option::<i64>, Some(-12_i64), Some("-12"));
|
||||||
test_for_type!(Option::<i64>, None, None);
|
test_for_type!(Option::<i64>, None, None);
|
||||||
test_for_type!(Option::<f32>, Some(-12.5 as f32), Some("-12.5"));
|
test_for_type!(Option::<f32>, Some(-12.5_f32), Some("-12.5"));
|
||||||
test_for_type!(Option::<f32>, None, None);
|
test_for_type!(Option::<f32>, None, None);
|
||||||
test_for_type!(Option::<f64>, Some(-12.5 as f64), Some("-12.5"));
|
test_for_type!(Option::<f64>, Some(-12.5_f64), Some("-12.5"));
|
||||||
test_for_type!(Option::<f64>, None, None);
|
test_for_type!(Option::<f64>, None, None);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -50,29 +50,29 @@ fn basic_option_types() {
|
|||||||
test_for_attribute_type!(Option::<String>, None, None);
|
test_for_attribute_type!(Option::<String>, None, None);
|
||||||
test_for_attribute_type!(Option::<bool>, Some(true), Some("true"));
|
test_for_attribute_type!(Option::<bool>, Some(true), Some("true"));
|
||||||
test_for_attribute_type!(Option::<bool>, None, None);
|
test_for_attribute_type!(Option::<bool>, None, None);
|
||||||
test_for_attribute_type!(Option::<u8>, Some(12 as u8), Some("12"));
|
test_for_attribute_type!(Option::<u8>, Some(12_u8), Some("12"));
|
||||||
test_for_attribute_type!(Option::<u8>, None, None);
|
test_for_attribute_type!(Option::<u8>, None, None);
|
||||||
test_for_attribute_type!(Option::<i8>, Some(12 as i8), Some("12"));
|
test_for_attribute_type!(Option::<i8>, Some(12_i8), Some("12"));
|
||||||
test_for_attribute_type!(Option::<i8>, Some(-12 as i8), Some("-12"));
|
test_for_attribute_type!(Option::<i8>, Some(-12_i8), Some("-12"));
|
||||||
test_for_attribute_type!(Option::<i8>, None, None);
|
test_for_attribute_type!(Option::<i8>, None, None);
|
||||||
test_for_attribute_type!(Option::<u16>, Some(12 as u16), Some("12"));
|
test_for_attribute_type!(Option::<u16>, Some(12_u16), Some("12"));
|
||||||
test_for_attribute_type!(Option::<u16>, None, None);
|
test_for_attribute_type!(Option::<u16>, None, None);
|
||||||
test_for_attribute_type!(Option::<i16>, Some(12 as i16), Some("12"));
|
test_for_attribute_type!(Option::<i16>, Some(12_i16), Some("12"));
|
||||||
test_for_attribute_type!(Option::<i16>, Some(-12 as i16), Some("-12"));
|
test_for_attribute_type!(Option::<i16>, Some(-12_i16), Some("-12"));
|
||||||
test_for_attribute_type!(Option::<i16>, None, None);
|
test_for_attribute_type!(Option::<i16>, None, None);
|
||||||
test_for_attribute_type!(Option::<u32>, Some(12 as u32), Some("12"));
|
test_for_attribute_type!(Option::<u32>, Some(12_u32), Some("12"));
|
||||||
test_for_attribute_type!(Option::<u32>, None, None);
|
test_for_attribute_type!(Option::<u32>, None, None);
|
||||||
test_for_attribute_type!(Option::<i32>, Some(12 as i32), Some("12"));
|
test_for_attribute_type!(Option::<i32>, Some(12_i32), Some("12"));
|
||||||
test_for_attribute_type!(Option::<i32>, Some(-12 as i32), Some("-12"));
|
test_for_attribute_type!(Option::<i32>, Some(-12_i32), Some("-12"));
|
||||||
test_for_attribute_type!(Option::<i32>, None, None);
|
test_for_attribute_type!(Option::<i32>, None, None);
|
||||||
test_for_attribute_type!(Option::<u64>, Some(12 as u64), Some("12"));
|
test_for_attribute_type!(Option::<u64>, Some(12_u64), Some("12"));
|
||||||
test_for_attribute_type!(Option::<u64>, None, None);
|
test_for_attribute_type!(Option::<u64>, None, None);
|
||||||
test_for_attribute_type!(Option::<i64>, Some(12 as i64), Some("12"));
|
test_for_attribute_type!(Option::<i64>, Some(12_i64), Some("12"));
|
||||||
test_for_attribute_type!(Option::<i64>, Some(-12 as i64), Some("-12"));
|
test_for_attribute_type!(Option::<i64>, Some(-12_i64), Some("-12"));
|
||||||
test_for_attribute_type!(Option::<i64>, None, None);
|
test_for_attribute_type!(Option::<i64>, None, None);
|
||||||
test_for_attribute_type!(Option::<f32>, Some(-12.5 as f32), Some("-12.5"));
|
test_for_attribute_type!(Option::<f32>, Some(-12.5_f32), Some("-12.5"));
|
||||||
test_for_attribute_type!(Option::<f32>, None, None);
|
test_for_attribute_type!(Option::<f32>, None, None);
|
||||||
test_for_attribute_type!(Option::<f64>, Some(-12.5 as f64), Some("-12.5"));
|
test_for_attribute_type!(Option::<f64>, Some(-12.5_f64), Some("-12.5"));
|
||||||
test_for_attribute_type!(Option::<f64>, None, None);
|
test_for_attribute_type!(Option::<f64>, None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ fn skip_serializing_if_for_struct() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl XmlStruct {
|
impl XmlStruct {
|
||||||
fn check_string_function(&self, value: &String) -> bool {
|
fn check_string_function(&self, value: &str) -> bool {
|
||||||
value == "something"
|
value == "something"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ fn skip_serializing_if_for_struct() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_f32_function(&self, value: &f32) -> bool {
|
fn check_f32_function(&self, value: &f32) -> bool {
|
||||||
value == &0.0
|
(value - 0.0).abs() < f32::EPSILON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,37 +13,37 @@ fn ser_type() {
|
|||||||
|
|
||||||
test_for_type!(String, "test".to_string(), Some("test"));
|
test_for_type!(String, "test".to_string(), Some("test"));
|
||||||
test_for_type!(bool, true, Some("true"));
|
test_for_type!(bool, true, Some("true"));
|
||||||
test_for_type!(u8, 12 as u8, Some("12"));
|
test_for_type!(u8, 12_u8, Some("12"));
|
||||||
test_for_type!(i8, 12 as i8, Some("12"));
|
test_for_type!(i8, 12_i8, Some("12"));
|
||||||
test_for_type!(i8, -12 as i8, Some("-12"));
|
test_for_type!(i8, -12_i8, Some("-12"));
|
||||||
test_for_type!(u16, 12 as u16, Some("12"));
|
test_for_type!(u16, 12_u16, Some("12"));
|
||||||
test_for_type!(i16, 12 as i16, Some("12"));
|
test_for_type!(i16, 12_i16, Some("12"));
|
||||||
test_for_type!(i16, -12 as i16, Some("-12"));
|
test_for_type!(i16, -12_i16, Some("-12"));
|
||||||
test_for_type!(u32, 12 as u32, Some("12"));
|
test_for_type!(u32, 12_u32, Some("12"));
|
||||||
test_for_type!(i32, 12 as i32, Some("12"));
|
test_for_type!(i32, 12_i32, Some("12"));
|
||||||
test_for_type!(i32, -12 as i32, Some("-12"));
|
test_for_type!(i32, -12_i32, Some("-12"));
|
||||||
test_for_type!(u64, 12 as u64, Some("12"));
|
test_for_type!(u64, 12_u64, Some("12"));
|
||||||
test_for_type!(i64, 12 as i64, Some("12"));
|
test_for_type!(i64, 12_i64, Some("12"));
|
||||||
test_for_type!(i64, -12 as i64, Some("-12"));
|
test_for_type!(i64, -12_i64, Some("-12"));
|
||||||
test_for_type!(f32, -12.5 as f32, Some("-12.5"));
|
test_for_type!(f32, -12.5_f32, Some("-12.5"));
|
||||||
test_for_type!(f64, -12.5 as f64, Some("-12.5"));
|
test_for_type!(f64, -12.5_f64, Some("-12.5"));
|
||||||
test_for_type!(Vec::<String>, vec![], None);
|
test_for_type!(Vec::<String>, vec![], None);
|
||||||
test_for_type!(Vec::<String>, vec!["test".to_string()], Some("test"));
|
test_for_type!(Vec::<String>, vec!["test".to_string()], Some("test"));
|
||||||
|
|
||||||
test_for_attribute_type!(String, "test".to_string(), Some("test"));
|
test_for_attribute_type!(String, "test".to_string(), Some("test"));
|
||||||
test_for_attribute_type!(bool, true, Some("true"));
|
test_for_attribute_type!(bool, true, Some("true"));
|
||||||
test_for_attribute_type!(u8, 12 as u8, Some("12"));
|
test_for_attribute_type!(u8, 12_u8, Some("12"));
|
||||||
test_for_attribute_type!(i8, 12 as i8, Some("12"));
|
test_for_attribute_type!(i8, 12_i8, Some("12"));
|
||||||
test_for_attribute_type!(i8, -12 as i8, Some("-12"));
|
test_for_attribute_type!(i8, -12_i8, Some("-12"));
|
||||||
test_for_attribute_type!(u16, 12 as u16, Some("12"));
|
test_for_attribute_type!(u16, 12_u16, Some("12"));
|
||||||
test_for_attribute_type!(i16, 12 as i16, Some("12"));
|
test_for_attribute_type!(i16, 12_i16, Some("12"));
|
||||||
test_for_attribute_type!(i16, -12 as i16, Some("-12"));
|
test_for_attribute_type!(i16, -12_i16, Some("-12"));
|
||||||
test_for_attribute_type!(u32, 12 as u32, Some("12"));
|
test_for_attribute_type!(u32, 12_u32, Some("12"));
|
||||||
test_for_attribute_type!(i32, 12 as i32, Some("12"));
|
test_for_attribute_type!(i32, 12_i32, Some("12"));
|
||||||
test_for_attribute_type!(i32, -12 as i32, Some("-12"));
|
test_for_attribute_type!(i32, -12_i32, Some("-12"));
|
||||||
test_for_attribute_type!(u64, 12 as u64, Some("12"));
|
test_for_attribute_type!(u64, 12_u64, Some("12"));
|
||||||
test_for_attribute_type!(i64, 12 as i64, Some("12"));
|
test_for_attribute_type!(i64, 12_i64, Some("12"));
|
||||||
test_for_attribute_type!(i64, -12 as i64, Some("-12"));
|
test_for_attribute_type!(i64, -12_i64, Some("-12"));
|
||||||
test_for_attribute_type!(f32, -12.5 as f32, Some("-12.5"));
|
test_for_attribute_type!(f32, -12.5_f32, Some("-12.5"));
|
||||||
test_for_attribute_type!(f64, -12.5 as f64, Some("-12.5"));
|
test_for_attribute_type!(f64, -12.5_f64, Some("-12.5"));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user