binarystream/stream/signed/int16.rs
1use napi_derive::napi;
2use napi::Result;
3use crate::binary::BinaryStream;
4use crate::stream::Endianness;
5use crate::types::Int16;
6
7#[napi]
8impl BinaryStream {
9 #[napi]
10 /**
11 * **readInt16**
12 *
13 * Reads a signed 16-bit ( 2 bytes ) integer from the stream. ( -32768 to 32767 )
14 */
15 pub fn read_int16(&mut self, endian: Option<Endianness>) -> Result<i16> {
16 Int16::read(self, endian)
17 }
18
19 #[napi]
20 /**
21 * **writeInt16**
22 *
23 * Writes a signed 16-bit ( 2 bytes ) integer to the stream. ( -32768 to 32767 )
24 */
25 pub fn write_int16(&mut self, value: i16, endian: Option<Endianness>) {
26 Int16::write(self, value, endian);
27 }
28}