#[repr(C)]pub struct Pingwave {
pub origin_id: u64,
pub seq: u64,
pub ttl: u8,
pub hop_count: u8,
pub _reserved: [u8; 6],
}Expand description
Pingwave packet for neighbor discovery.
Layout (24 bytes):
┌────────────────────────────────────────────────────────────┐
│ origin_id (8) │ seq (8) │ ttl (1) │ hops (1) │ reserved (6)│
└────────────────────────────────────────────────────────────┘Fields§
§origin_id: u64Originating node ID
seq: u64Sequence number (monotonic per origin)
ttl: u8Time-to-live (usually 2-3 hops)
hop_count: u8Hop count so far
_reserved: [u8; 6]Reserved for future use
Implementations§
Source§impl Pingwave
impl Pingwave
Sourcepub fn from_bytes(buf: &[u8]) -> Option<Self>
pub fn from_bytes(buf: &[u8]) -> Option<Self>
Deserialize from bytes
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if pingwave has expired (TTL = 0)
Trait Implementations§
impl Copy for Pingwave
impl Eq for Pingwave
impl StructuralPartialEq for Pingwave
Auto Trait Implementations§
impl Freeze for Pingwave
impl RefUnwindSafe for Pingwave
impl Send for Pingwave
impl Sync for Pingwave
impl Unpin for Pingwave
impl UnsafeUnpin for Pingwave
impl UnwindSafe for Pingwave
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.