News for hackers. Stuff that matters.
Re:Back to old tricks, or, baby steps in Rust by comex on Saturday July 04, 2020 @08:23PM (#23735808)
But you don't always need random access; often you only need sequential access, in which case you can pack differently-sized values into a single buffer. However, Rust enums don't support that use case. A macro could probably do it without too much loss of ergonomics, but I'm not sure if there's a good crate for it.
Re:Back to old tricks, or, baby steps in Rust by jacb on Sunday July 05, 2020 @04:27AM (#23737340)
That's a good point! I guess you'd still have to make sure that variants with alignment requirements don't get unaligned. One way to do that would be to add leading padding if they follow an unaligned variant. Adds some complexity to the representation, I guess, and I suspect there's other ways of doing it. Neat problem.