miso_types/lib.rs
1mod hint;
2pub mod u16_prefix_vec;
3pub mod u8_prefix_vec;
4
5pub use u16_prefix_vec::U16PrefixVec;
6pub use u8_prefix_vec::U8PrefixVec;
7
8use borsh::BorshSerialize;
9use std::io::{Result, Write};
10
11/// Helper method that is used to serialize a slice of data (without the length marker).
12#[inline]
13fn serialize_slice<T: BorshSerialize, W: Write>(data: &[T], writer: &mut W) -> Result<()> {
14 if let Some(u8_slice) = T::u8_slice(data) {
15 writer.write_all(u8_slice)?;
16 } else {
17 for item in data {
18 item.serialize(writer)?;
19 }
20 }
21 Ok(())
22}