Add tjs/ns0 create support

This commit is contained in:
2025-09-17 14:02:49 +08:00
parent 9cdd977c3e
commit 1e0c92a3a1
5 changed files with 288 additions and 13 deletions

View File

@@ -76,3 +76,18 @@ impl<T: StructUnpack> StructUnpack for Option<T> {
Ok(Some(value))
}
}
impl<const T: usize> StructPack for [u8; T] {
fn pack<W: Write>(&self, writer: &mut W, _big: bool, _encoding: Encoding) -> Result<()> {
writer.write_all(self)?;
Ok(())
}
}
impl<const T: usize> StructUnpack for [u8; T] {
fn unpack<R: Read + Seek>(reader: &mut R, _big: bool, _encoding: Encoding) -> Result<Self> {
let mut buf = [0u8; T];
reader.read_exact(&mut buf)?;
Ok(buf)
}
}