libserialize: Do not coerce to integer when decoding a float value
When an integral value is expected by the user but a fractional value is found, the current implementation uses std::num::cast() to coerce to an integer type, losing the fractional part. This behavior is not desirable because the number loses precision without notice. This commit makes it raise ExpectedError when such a situation arises. [breaking-change]
Showing
想要评论请 注册 或 登录