use crate::coding::{Decode, Encode};
use crate::{Buf, BufMut, Result};
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PlainText {
pub data_reference_index: u16,
}
impl Encode for PlainText {
fn encode<B: BufMut>(&self, buf: &mut B) -> Result<()> {
0u32.encode(buf)?; 0u16.encode(buf)?; self.data_reference_index.encode(buf)?;
Ok(())
}
}
impl Decode for PlainText {
fn decode<B: Buf>(buf: &mut B) -> Result<Self> {
u32::decode(buf)?; u16::decode(buf)?; let data_reference_index = u16::decode(buf)?;
Ok(Self {
data_reference_index,
})
}
}