Skip to content

Commit 7ce54f6

Browse files
committed
Added the rust type to the asn.1 description
1 parent c74a9f5 commit 7ce54f6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/macros.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ macro_rules! asn1 {
2222
}
2323

2424
impl $name {
25-
fn asn1_description() -> Vec<(&'static str, &'static str)> {
25+
fn asn1_description() -> Vec<(&'static str, &'static str, &'static str)> {
2626
let mut description = vec![];
2727
$(
28-
description.push((stringify!($field_name), stringify!($field_type)));
28+
description.push((
29+
stringify!($field_name),
30+
stringify!($field_type),
31+
stringify!($field_rust_type)
32+
));
2933
)*
3034
return description;
3135
}
@@ -57,7 +61,7 @@ mod tests {
5761
}
5862
);
5963

60-
assert_eq!(Single::asn1_description(), vec![("x", "INTEGER")]);
64+
assert_eq!(Single::asn1_description(), vec![("x", "INTEGER", "i64")]);
6165
}
6266

6367
#[test]
@@ -70,8 +74,8 @@ mod tests {
7074
);
7175

7276
assert_eq!(Double::asn1_description(), vec![
73-
("x", "INTEGER"),
74-
("y", "BOOLEAN"),
77+
("x", "INTEGER", "i64"),
78+
("y", "BOOLEAN", "bool"),
7579
])
7680
}
7781

0 commit comments

Comments
 (0)