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: RejectMessageReasonWhy the message was refused. The set is open: an octet the standard doesn’t name is kept as received.
network: u16The network the refused message was for (its DNET).
Implementations§
Source§impl RejectMessageToNetwork
impl RejectMessageToNetwork
Sourcepub const fn decode(payload: &[u8]) -> Result<Self, RejectLengthError>
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.
Trait Implementations§
Source§impl Clone for RejectMessageToNetwork
impl Clone for RejectMessageToNetwork
impl Copy for RejectMessageToNetwork
Source§impl Debug for RejectMessageToNetwork
impl Debug for RejectMessageToNetwork
impl Eq for RejectMessageToNetwork
Source§impl PartialEq for RejectMessageToNetwork
impl PartialEq for RejectMessageToNetwork
impl StructuralPartialEq for RejectMessageToNetwork
Auto Trait Implementations§
impl Freeze for RejectMessageToNetwork
impl RefUnwindSafe for RejectMessageToNetwork
impl Send for RejectMessageToNetwork
impl Sync for RejectMessageToNetwork
impl Unpin for RejectMessageToNetwork
impl UnsafeUnpin for RejectMessageToNetwork
impl UnwindSafe for RejectMessageToNetwork
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