Skip to main content

RejectMessageToNetwork

Struct RejectMessageToNetwork 

Source
pub struct RejectMessageToNetwork {
    pub reason: RejectMessageReason,
    pub network: u16,
}
Expand description

What a Reject-Message-To-Network carries after its type (Clause 6.4.4): one reason octet, then the two-octet network the refused message was for.

It is the one reader and writer of that data in the stack: the router core, the hosted network layer and the client all go through it. It checks layout only; whether the enclosing NPDU is a reject is the caller’s question, and so is what the reason means for a route.

use bacnet_npdu::{RejectMessageReason, RejectMessageToNetwork};

let reject = RejectMessageToNetwork::decode(&[4, 0x0B, 0xB8])?;
assert_eq!(reject.reason, RejectMessageReason::MESSAGE_TOO_LONG);
assert_eq!(reject.network, 3000);
assert_eq!(reject.to_bytes(), [4, 0x0B, 0xB8]);

Fields§

§reason: RejectMessageReason

Why the message was refused. The set is open: an octet the standard doesn’t name is kept as received.

§network: u16

The network the refused message was for (its DNET).

Implementations§

Source§

impl RejectMessageToNetwork

Source

pub const LEN: usize = 3

The data’s length, in octets.

Source

pub const fn decode(payload: &[u8]) -> Result<Self, RejectLengthError>

Read exactly a reason octet and a network number. Any other length is refused, so a router never acts on a cut-short or padded reject.

Source

pub const fn to_bytes(self) -> [u8; 3]

The data, as sent.

Trait Implementations§

Source§

impl Clone for RejectMessageToNetwork

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for RejectMessageToNetwork

Source§

impl Debug for RejectMessageToNetwork

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RejectMessageToNetwork

Source§

impl PartialEq for RejectMessageToNetwork

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RejectMessageToNetwork

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.