1
0

adding more packet info getter

This commit is contained in:
EAimTY 2023-03-04 19:43:19 +09:00
parent 2c2f5623a7
commit 142ac2e461

View File

@ -51,6 +51,12 @@ impl<B> Packet<side::Tx, B> {
tx.assoc_id tx.assoc_id
} }
/// Returns the packet ID
pub fn pkt_id(&self) -> u16 {
let Side::Tx(tx) = &self.inner else { unreachable!() };
tx.pkt_id
}
/// Returns the address /// Returns the address
pub fn addr(&self) -> &Address { pub fn addr(&self) -> &Address {
let Side::Tx(tx) = &self.inner else { unreachable!() }; let Side::Tx(tx) = &self.inner else { unreachable!() };
@ -129,6 +135,24 @@ where
rx.assoc_id rx.assoc_id
} }
/// Returns the packet ID
pub fn pkt_id(&self) -> u16 {
let Side::Rx(rx) = &self.inner else { unreachable!() };
rx.pkt_id
}
/// Returns the fragment ID
pub fn frag_id(&self) -> u8 {
let Side::Rx(rx) = &self.inner else { unreachable!() };
rx.frag_id
}
/// Returns the total number of fragments
pub fn frag_total(&self) -> u8 {
let Side::Rx(rx) = &self.inner else { unreachable!() };
rx.frag_total
}
/// Returns the address /// Returns the address
pub fn addr(&self) -> &Address { pub fn addr(&self) -> &Address {
let Side::Rx(rx) = &self.inner else { unreachable!() }; let Side::Rx(rx) = &self.inner else { unreachable!() };