pub fn read_i16(buf: &[u8]) -> Result<i16, CopyReadError>Expand description
Reads an i16 value from HyperBinary format (LittleEndian).
§Errors
Returns CopyReadError::BufferTooShort if the buffer is too short (< 2 bytes).
§Example
use hyperdb_api_core::protocol::copy::{read_i16, CopyReadError};
let buf = [0x34, 0x12];
assert_eq!(read_i16(&buf).unwrap(), 0x1234);
let short_buf = [0x34];
assert!(matches!(read_i16(&short_buf), Err(CopyReadError::BufferTooShort { .. })));