Advice on HashMap with non-trivial key

This is probably not really zig specific, but I never had to deal with it before: Is there some advice on using a HashMap with non trivial keys beyond the following?

std.auto_hash.autoHash does not allow slices as well as unions and structs containing slices here (Key) because the intent is unclear. Consider using std.auto_hash.hash or providing your own hash function instead.

The key I’m trying to use looks like this:

const Key = struct {
    name: []u8,
    options: VariantMap,
};

const VariantMap = struct {
    const Variant = union(enum) {
        Bool: bool,
        UInt: u32,
    };

    map: std.StringHashMapUnmanaged(Variant) = .{},
};

I could conceivably use an AutoHashMap(u32, Variant) for the inner map, but I don´t think it makes it fundamentally easier.
Is there a smarter way than flatten everything into a byte array and call a hash function on it?

The crucial concept that I was missing, is that you don’t have to have the entire structure as a flat byte array, because you can use the Hasher in three steps: init(), update()/repeat update(), final(). Once this became clear to me, I could manage from there.