Skip to main content

Packet

Struct Packet 

Source
pub struct Packet {
    pub source_device_identifier: u8,
    pub id: IdType,
    pub data: PacketDataBytes,
    /* private fields */
}

Fields§

§source_device_identifier: u8§id: IdType§data: PacketDataBytes

Implementations§

Source§

impl Packet

Source

pub fn is_checksum_correct(&self) -> bool

Checks if the calculated checksum of the packet matches to the already stored one.

Source

pub fn summarized(self) -> Packet

Calculates checksum for this packet, and sets calculated value into .checksum field. returns new summarized packet.

Source§

impl Packet

Source

pub fn get_id(&self) -> IdType

Source

pub fn set_id(&mut self, id: IdType)

Source

pub fn increment_id(&mut self)

Source§

impl Packet

Source§

impl Packet

Source

pub fn deacrease_lifetime(self) -> Result<Self, PacketLifetimeEnded>

Source§

impl Packet

Source

pub fn mutated(self) -> Result<Self, RespondToBroadcastAddressError>

Source§

impl Packet

Source

pub fn get_spec_state(&self) -> PacketState

Source

pub fn set_spec_state(&mut self, new_state: PacketState)

Source§

impl Packet

Source

pub fn new( source_device_identifier: u8, destination_device_identifier: u8, id: IdType, lifetime: LifeTimeType, spec_state: PacketState, ignore_duplications_flag: bool, data: PacketDataBytes, ) -> Packet

Source

pub fn has_correct_source_device_identifier(&self) -> bool

Source

pub const fn size_of_bytes() -> usize

Trait Implementations§

Source§

impl Clone for Packet

Source§

fn clone(&self) -> Packet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.