1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//! Module for [`EndTag`].
use crate::{Tag, TagTrait, TagType, TagTypeId};
/// The end tag ends the information struct.
#[repr(C)]
#[derive(Debug)]
pub struct EndTag {
pub typ: TagTypeId,
pub size: u32,
}
impl Default for EndTag {
fn default() -> Self {
Self {
typ: TagType::End.into(),
size: 8,
}
}
}
impl TagTrait for EndTag {
const ID: TagType = TagType::End;
fn dst_size(_base_tag: &Tag) {}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
/// Compile time test for [`EndTag`].
fn test_end_tag_size() {
unsafe {
core::mem::transmute::<[u8; 8], EndTag>([0u8; 8]);
}
}
}