Function uniffi::check_remaining

source ·
pub fn check_remaining(buf: &[u8], num_bytes: usize) -> Result<(), Error>
Expand description

Reexport items from other uniffi creates A helper function to ensure we don’t read past the end of a buffer.

Rust won’t actually let us read past the end of a buffer, but the Buf trait does not support returning an explicit error in this case, and will instead panic. This is a look-before-you-leap helper function to instead return an explicit error, to help with debugging.