The current implementation has a bug that if the buffer is only partially written, it won't attempt to retry the option with the remaining bytes of the buffer. This PR fixes that by calling write in a loop. Also, I implemented some slightly more correct behaviour around integer limits by making use of try_from.
The current implementation has a bug that if the buffer is only partially written, it won't attempt to retry the option with the remaining bytes of the buffer. This PR fixes that by calling
write
in a loop. Also, I implemented some slightly more correct behaviour around integer limits by making use oftry_from
.