pub struct DiagnosticsRequest<'buf> {
pub sub_function: DiagnosticSubFunction,
pub data: &'buf [u8],
}Expand description
FC 0x08 — Diagnostics request.
The sub-function code selects the diagnostic action. Diagnostic data is
encoded as N x 2 bytes per Spec V1.1b3 §6.8.
Fields§
§sub_function: DiagnosticSubFunctionDiagnostic sub-function code.
data: &'buf [u8]Sub-function data (typically 2 bytes, but variable for Return Query Data).
Implementations§
Source§impl<'buf> DiagnosticsRequest<'buf>
impl<'buf> DiagnosticsRequest<'buf>
Sourcepub fn decode(data: &'buf [u8]) -> Result<Self, DecodeError>
pub fn decode(data: &'buf [u8]) -> Result<Self, DecodeError>
Decode from PDU data after the function code byte.
§Errors
Returns DecodeError::Truncated if data is shorter than 2 bytes.
Returns DecodeError::UnknownFunctionCode if the sub-function code is not recognized
(reused as a general “unknown sub-code” error via the raw value).
Returns DecodeError::InvalidDiagnosticDataLength if the payload is not
an even number of bytes.
Trait Implementations§
Source§impl<'buf> Clone for DiagnosticsRequest<'buf>
impl<'buf> Clone for DiagnosticsRequest<'buf>
Source§fn clone(&self) -> DiagnosticsRequest<'buf>
fn clone(&self) -> DiagnosticsRequest<'buf>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'buf> Copy for DiagnosticsRequest<'buf>
Source§impl<'buf> Debug for DiagnosticsRequest<'buf>
impl<'buf> Debug for DiagnosticsRequest<'buf>
Source§impl Encode for DiagnosticsRequest<'_>
impl Encode for DiagnosticsRequest<'_>
Source§fn encode_into(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
fn encode_into(&self, buf: &mut [u8]) -> Result<usize, EncodeError>
Write the full PDU (function code + data) into
buf. Read moreSource§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Total encoded length in bytes (including the function code byte).
impl<'buf> Eq for DiagnosticsRequest<'buf>
Source§impl<'buf> PartialEq for DiagnosticsRequest<'buf>
impl<'buf> PartialEq for DiagnosticsRequest<'buf>
Source§fn eq(&self, other: &DiagnosticsRequest<'buf>) -> bool
fn eq(&self, other: &DiagnosticsRequest<'buf>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<'buf> StructuralPartialEq for DiagnosticsRequest<'buf>
Auto Trait Implementations§
impl<'buf> Freeze for DiagnosticsRequest<'buf>
impl<'buf> RefUnwindSafe for DiagnosticsRequest<'buf>
impl<'buf> Send for DiagnosticsRequest<'buf>
impl<'buf> Sync for DiagnosticsRequest<'buf>
impl<'buf> Unpin for DiagnosticsRequest<'buf>
impl<'buf> UnsafeUnpin for DiagnosticsRequest<'buf>
impl<'buf> UnwindSafe for DiagnosticsRequest<'buf>
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