use super::Wasmbin;

macro_rules! newtype_idx {
    ($name:ident) => {
        #[derive(Debug, PartialEq, Eq, Clone, Copy, Wasmbin)]
        #[repr(transparent)]
        pub struct $name {
            pub index: u32,
        }
    };
}

newtype_idx!(TypeIdx);
newtype_idx!(FuncIdx);
newtype_idx!(TableIdx);
newtype_idx!(MemIdx);
newtype_idx!(GlobalIdx);
newtype_idx!(LocalIdx);
newtype_idx!(LabelIdx);

use super::Wasmbin;

macro_rules! newtype_idx {
    ($name:ident) => {
        #[derive(Debug, PartialEq, Eq, Clone, Copy, Wasmbin)]
        pub struct $name(u32);
    };
}

newtype_idx!(TypeIdx);
newtype_idx!(FuncIdx);
newtype_idx!(TableIdx);
newtype_idx!(MemIdx);
newtype_idx!(GlobalIdx);
newtype_idx!(LocalIdx);
newtype_idx!(LabelIdx);

--- 
+++ 
@@ -3,7 +3,10 @@
 macro_rules! newtype_idx {
     ($name:ident) => {
         #[derive(Debug, PartialEq, Eq, Clone, Copy, Wasmbin)]
-        pub struct $name(u32);
+        #[repr(transparent)]
+        pub struct $name {
+            pub index: u32,
+        }
     };
 }
 
Allow access to index value
