intern_mint/databuf.rs
1use std::io::Write;
2
3use databuf::{Decode, Encode};
4
5use crate::interned::Interned;
6
7impl Encode for Interned {
8 #[inline]
9 fn encode<const CONFIG: u16>(&self, w: &mut (impl Write + ?Sized)) -> std::io::Result<()> {
10 Encode::encode::<CONFIG>(self as &[u8], w)
11 }
12}
13
14impl Decode<'_> for Interned {
15 #[inline]
16 fn decode<const CONFIG: u16>(c: &mut &[u8]) -> databuf::Result<Self> {
17 let data = Vec::<u8>::decode::<CONFIG>(c)?;
18 Ok(data.into())
19 }
20}