mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
`napi` only supports numbers in 16 and 32-bits. To support Rust numbers with 8 and 16-bits, we can cast them to 32-bits. To convert from 8 and 16-bits to 32-bits, we use their `Into` implementation. To convert from 32-bits to 8 and 16-bits, we use their `TryInto`, we should theorically not fail, but in case of, an `except` message is appended. The code has also been re-indented as it was containing a mix of 2 spaces, 4 spaces and tabs identation.