Skip to content

Commit

Permalink
Bugfix. Replace default isize enum representation.
Browse files Browse the repository at this point in the history
By default Rust uses isize to represent enum values.
isize implementation depends on the `target_pointer_width` attribute.

- Mavlink implementation for v2 requires message id with the range 0..16777215 --> u32
- Mavlink implementation requires u32 enum entry values
  • Loading branch information
antonio-sc66 authored and patrickelectric committed Jan 3, 2024
1 parent 19154d8 commit 76a2813
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ with bindings for all message sets.
Add to your Cargo.toml:

```
mavlink = "0.10.1"
mavlink = "0.12.2"
```

## Examples
Expand Down
2 changes: 2 additions & 0 deletions build/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ impl MavProfile {
quote! {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[repr(u32)]
pub enum MavMessage {
#(#enums(#structs),)*
}
Expand Down Expand Up @@ -390,6 +391,7 @@ impl MavEnum {
#[derive(Debug, Copy, Clone, PartialEq, FromPrimitive, ToPrimitive)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[repr(u32)]
#description
pub enum #enum_name {
#(#defs)*
Expand Down

0 comments on commit 76a2813

Please sign in to comment.