use super::Chunk;
use crate::model::mdx;
use crate::model::{Encoder, Tag};
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct RawChunk {
pub tag: Tag,
pub data: Vec<u8>,
}
impl RawChunk {
pub fn new(tag: Tag, data: Vec<u8>) -> Self {
Self { tag, data }
}
}
impl Chunk for RawChunk {
fn tag(&self) -> Tag {
self.tag
}
fn encode_payload_to(&self, output: &mut Encoder<'_>) -> Result<(), mdx::WriteError> {
output.write_bytes(&self.data);
Ok(())
}
}