Encode_to_vec bincode

What does it do when given standard config? Is it like bytemuck::cast_slice at all?

It isn't like cast_slice at all, what it does it depends on the config and for a standard config, it is little endian with a variable width encoding.

So even with legacy it doesn't do anything like cast_slice?

Nope, legacy is just little endian but fixed width if I recall, so encode is actually encoding.

It's never casting. It always encodes a copy. The encoding may be simple, but it's not a cast.