dns_message_parser/encode/
macros.rs1macro_rules! impl_encode_without_result {
2 ($i:path, $m:ident) => {
3 impl $i {
4 pub fn encode(&self) -> bytes::BytesMut {
5 let mut encoder = crate::encode::Encoder::default();
6 encoder.$m(self);
7 encoder.bytes
8 }
9 }
10 };
11}
12
13macro_rules! impl_encode {
14 ($i:path, $m:ident) => {
15 impl $i {
16 pub fn encode(&self) -> crate::EncodeResult<bytes::BytesMut> {
17 let mut encoder = crate::encode::Encoder::default();
18 encoder.$m(self)?;
19 Ok(encoder.bytes)
20 }
21 }
22 };
23}