Function uniffi::check_remaining[][src]

pub fn check_remaining<B: Buf>(buf: &B, num_bytes: usize) -> Result<()>
Expand description

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.