3 ms·
You don't know on input if the bit pattern will be valid. If you're going to coerce raw bytes into it, the usual case for network protocols, you have to be prep
by Animats 2y ago
You don't know on input if the bit pattern will be valid. If you're going to coerce raw bytes into it, the usual case for network protocols, you have to be prepared for any bit pattern.
- wyager 2y agoThe article also discusses a `TryTransmute` trait which will cover this case. Additionally, you often want to coerce from the constrained in-memory representation to the wire representation.