Probably a rookie mistake, mismatched type error in zig-bincode

Okay, so I applied the differences from the PR you linked, ran it on Zig 0.12.0 after changing count to const and it works totally fine on my system.

1 Like

I lost my account, but this was spot on

I tried nesting structures, but when I try to attempt this I get a unsuccessful cast. Given a struct like so

pub const TestEnum = enum(u8) { First = 0, Second };
pub const Nesting = struct { message: []const u8, integer32: u32, integer32_2: u32 };

pub const Random = struct {
    packet: TestEnum,
    spec: []const u8, // bincode serialized structure
};

with these standard settings (Legacy does not even work at all from my experience)

.{
        .endian = .little,
        .int_encoding = .variable,
        .include_fixed_array_length = true,
    }

it either fails to deserialize for numbers greater than u8, or it outputs a wrong number. Hope I’m not missing anything obvious here

:sweat_smile:

Just some discovery, I tried the official Rust implementation of a comparable struct to the one i posted above, and i figure that might be a implementation within this one in Zig instead? I’m not really sure, but it’s definitely strange. If anyone has time to replicate and check it out it would mean a bunch :saluting_face:

Pinging @AndrewCodeDev