Add support for to the macro
This commit is contained in:
@@ -28,4 +28,13 @@ struct GpsData3 {
|
||||
pub lon: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "visual-frame", condition = "changed", interval = 0)]
|
||||
struct GpsData4 {
|
||||
#[simconnect(name = "PLANE LATITUDE", unit = "degrees")]
|
||||
pub lat: f64,
|
||||
#[simconnect(name = "PLANE LONGITUDE", unit = "degrees")]
|
||||
pub lon: f64,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@@ -21,19 +21,27 @@ struct GpsData4 {}
|
||||
struct GpsData5 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(condition = "none", condition = "none")]
|
||||
#[simconnect(period = "second", condition = "none", condition = "none")]
|
||||
struct GpsData6 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", condition = "none", test = "test")]
|
||||
#[simconnect(period = "second", interval = 0, interval = 0)]
|
||||
struct GpsData7 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(periodX = "second", condition = "none")]
|
||||
#[simconnect(period = "second", test = "test")]
|
||||
struct GpsData8 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", conditionX = "none")]
|
||||
#[simconnect(periodX = "second", condition = "none")]
|
||||
struct GpsData9 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", conditionX = "none")]
|
||||
struct GpsData10 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", intervalX = 0)]
|
||||
struct GpsData11 {}
|
||||
|
||||
fn main() {}
|
||||
|
@@ -5,50 +5,62 @@ error: Unsupported field type. Only named fields are supported.
|
||||
6 | | struct GpsData1(f64);
|
||||
| |_____________________^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:9:1
|
||||
|
|
||||
9 | struct GpsData2 {}
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:12:3
|
||||
|
|
||||
12 | #[simconnect]
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:16:3
|
||||
|
|
||||
16 | #[simconnect()]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:20:3
|
||||
|
|
||||
20 | #[simconnect(period = "second", period = "second")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:24:3
|
||||
|
|
||||
24 | #[simconnect(condition = "none", condition = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
24 | #[simconnect(period = "second", condition = "none", condition = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:28:3
|
||||
|
|
||||
28 | #[simconnect(period = "second", condition = "none", test = "test")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
28 | #[simconnect(period = "second", interval = 0, interval = 0)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:32:3
|
||||
|
|
||||
32 | #[simconnect(periodX = "second", condition = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
32 | #[simconnect(period = "second", test = "test")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...")]`
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:36:3
|
||||
|
|
||||
36 | #[simconnect(period = "second", conditionX = "none")]
|
||||
36 | #[simconnect(periodX = "second", condition = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:40:3
|
||||
|
|
||||
40 | #[simconnect(period = "second", conditionX = "none")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected attribute `#[simconnect(period = "...", condition = "...", interval = ...)]`. `condition` and `interval` are optional.
|
||||
--> tests/02-struct-attr-errors.rs:44:3
|
||||
|
|
||||
44 | #[simconnect(period = "second", intervalX = 0)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@@ -17,9 +17,17 @@ struct GpsData3 {}
|
||||
#[simconnect(period = "second", condition = "X")]
|
||||
struct GpsData4 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", interval = "X")]
|
||||
struct GpsData5 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", interval = 0.0)]
|
||||
struct GpsData6 {}
|
||||
|
||||
#[derive(Debug, Clone, SimConnectObject)]
|
||||
#[simconnect(period = "second", condition = "none")]
|
||||
struct GpsData5 {
|
||||
struct GpsData7 {
|
||||
#[simconnect(name = "PLANE LATITUDE", unit = "degrees")]
|
||||
pub lat: String,
|
||||
}
|
||||
|
@@ -1,30 +1,42 @@
|
||||
error: expected string, found Int(LitInt { token: 123 })
|
||||
error: Expected Str, found Int(LitInt { token: 123 })
|
||||
--> tests/04-invalid-values.rs:5:14
|
||||
|
|
||||
5 | #[simconnect(period = 123, condition = "none")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: expected string, found Int(LitInt { token: 123 })
|
||||
error: Expected Str, found Int(LitInt { token: 123 })
|
||||
--> tests/04-invalid-values.rs:9:33
|
||||
|
|
||||
9 | #[simconnect(period = "second", condition = 123)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: `period` must be one of ['once', 'visual-frame', 'sim-frame', 'second']
|
||||
error: `period` must be one of ["once", "visual-frame", "sim-frame", "second"]
|
||||
--> tests/04-invalid-values.rs:13:14
|
||||
|
|
||||
13 | #[simconnect(period = "X")]
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
error: `condition` must be one of ['none', 'changed']
|
||||
error: `condition` must be one of ["none", "changed"]
|
||||
--> tests/04-invalid-values.rs:17:33
|
||||
|
|
||||
17 | #[simconnect(period = "second", condition = "X")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: Field type must be one of ['f64', 'bool']
|
||||
--> tests/04-invalid-values.rs:23:5
|
||||
error: Expected Int, found Str(LitStr { token: "X" })
|
||||
--> tests/04-invalid-values.rs:21:33
|
||||
|
|
||||
23 | / #[simconnect(name = "PLANE LATITUDE", unit = "degrees")]
|
||||
24 | | pub lat: String,
|
||||
21 | #[simconnect(period = "second", interval = "X")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: Expected Int, found Float(LitFloat { token: 0.0 })
|
||||
--> tests/04-invalid-values.rs:25:33
|
||||
|
|
||||
25 | #[simconnect(period = "second", interval = 0.0)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: Field type must be one of ["f64", "bool"]
|
||||
--> tests/04-invalid-values.rs:31:5
|
||||
|
|
||||
31 | / #[simconnect(name = "PLANE LATITUDE", unit = "degrees")]
|
||||
32 | | pub lat: String,
|
||||
| |___________________^
|
||||
|
Reference in New Issue
Block a user