pub fn read_i32(buf: &[u8]) -> Result<i32, CopyReadError>Expand description
Reads an i32 value from HyperBinary format (LittleEndian).
§Errors
Returns CopyReadError::BufferTooShort if the buffer is too short (< 4 bytes).
§Example
use hyperdb_api_core::protocol::copy::{read_i32, CopyReadError};
let buf = [0x04, 0x03, 0x02, 0x01];
assert_eq!(read_i32(&buf).unwrap(), 0x01020304);
let short_buf = [0x04, 0x03, 0x02];
assert!(matches!(read_i32(&short_buf), Err(CopyReadError::BufferTooShort { .. })));