The #[rustc_layout_scalar_valid_range_start(...)] and #[rustc_layout_scalar_valid_range_end(...)] attribute allows you to specify a niche, so you can build a Non255U8 if you want. For example:
#[rustc_layout_scalar_valid_range_end(254)] struct Non255U8(u8);
> Helper Lambdas
> I like lambdas in C++11. I use them regularly for small helpers that exist solely within a function.
`move` lambdas might work better? The default tries to infer based on usage but often fails. A `move` lambda lets you do something similar to C++'s capture lists (though more verbose / cumbersome).
> BinaryHeap
> The standard library provides a max-heap. I regularly needed a min-heap. I got one by making a custom struct with custom compare function.
std::cmp::Reverse
> I wonder if there is a nice macro crate to help with this? I'd love to write: compare!(a, b, year, month, day, hour, minute);
sort_by_key?
> I wish there was an f16 half-precision float. There's a good internals thread on minifloats that makes me think f16 will happen eventually.
A problem's there is there are at least two "standard" f16 (IEEE and ML)
> There is NonZeroU32. It's similar-ish, but only works for zero. There isn't a Non255U8 or, thankfully, Non4294967296U32.
They're built from the unstable `NonZero` (and the unstable and unsafe ZeroAble).
You could build a struct on top of NonZero which swaps zero and your sentinel value.