Derive Macro libwifi_macros::AddressHeader [−][src]
#[derive(AddressHeader)]
A little helper derive macro to implement the libwifi::Addresses
trait
for frames with either a DataHeader or a ManagementHeader.
This macro is only designed for internal usage in the libwifi crate.
How to use:
#[derive(Clone, Debug, AddressHeader)] pub struct AssociationRequest { pub header: ManagementHeader, pub beacon_interval: u16, pub capability_info: u16, pub station_info: StationInfo, }
The new generated code will look like this:
impl crate::Addresses for AssociationRequest { fn src(&self) -> Option<&MacAddress> { self.header.src() } fn dest(&self) -> &MacAddress { self.header.dest() } fn bssid(&self) -> Option<&MacAddress> { self.header.bssid() } }