From 76a28133e2de4220f507dca43072c2e639bfbb3b Mon Sep 17 00:00:00 2001
From: Antonio Sanjurjo C <74329840+antonio-sc66@users.noreply.github.com>
Date: Wed, 3 Jan 2024 22:33:03 +0100
Subject: [PATCH] Bugfix. Replace default isize enum representation.

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
---
 README.md       | 2 +-
 build/parser.rs | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 37cf297..4559484 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ with bindings for all message sets.
 Add to your Cargo.toml:
 
 ```
-mavlink = "0.10.1"
+mavlink = "0.12.2"
 ```
 
 ## Examples
diff --git a/build/parser.rs b/build/parser.rs
index f14c695..a0618c5 100644
--- a/build/parser.rs
+++ b/build/parser.rs
@@ -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),)*
             }
@@ -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)*
-- 
GitLab