Macro blaze_pk::packet

source ·
macro_rules! packet {
    (
        struct $name:ident {
            $(
                $tag:ident $field:ident: $ty:ty
            ),* $(,)?
        }

    ) => { ... };
}
Expand description

Macro for generating structures that can be encoded and decoded from bytes (DONT USE THIS FOR GROUPS USE tdf_group because they require extra bytes)

You can only use types that implement Codec the ones implemented by this library are

Example Usage


use blaze_pk::{packet, Blob};

packet! {
    struct Test {
        TEST: u16,
        ALT: String,
        BYT: Blob
    }
}

Generated structs can then be used as packet body’s when creating packets