derive traits for Magic<>

This commit is contained in:
Numbers
2025-05-29 04:28:14 +02:00
parent 295d8b0026
commit b0f369e809

View File

@@ -1,7 +1,14 @@
use core::fmt::{Debug, Formatter};
use crate::{MalformedData, OverTheWire, Reader, Writer};
/// Zero-sized type that is written as a 4-byte magic number used for validation
#[derive(
Eq, PartialEq,
Ord, PartialOrd,
Hash, Default,
Copy, Clone
)]
pub struct Magic<const VALUE: u32>;
impl<const V: u32> OverTheWire for Magic<V> {
@@ -24,4 +31,6 @@ impl<const V: u32> OverTheWire for Magic<V> {
}
}
impl<const V: u32> Debug for Magic<V> {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { ().fmt(f) }
}