#Error trying to convert u32 to u8[] slice

1 messages · Page 1 of 1 (latest)

fluid shore
#

Relevant code:
This is the trouble line
const keyBytes = try std.mem.asBytes(&entry.keySize);
Here is the entry struct

const Entry = struct {
    keySize: u32,
    valSize: u32
};

Giving me

main.zig:195:45: error: expected error union type, found '*align(4) const [4]u8
        const keyBytes = try std.mem.asBytes(&entry.keySize);

                             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~

I am pretty stumped on this, the docs dont show that mem.asBytes throws any errors, unless I dont know what I'm looking for...

hardy flicker
#

since it doesn't return an error union you can't use try