pub struct RdwHeader { /* private fields */ }Expand description
Parsed RDW header (length + reserved).
A 4-byte Record Descriptor Word containing a 2-byte big-endian payload length and 2 reserved bytes.
§Examples
use copybook_rdw::RdwHeader;
let header = RdwHeader::from_bytes([0x00, 0x50, 0x00, 0x00]);
assert_eq!(header.length(), 80);
assert_eq!(header.reserved(), 0);Implementations§
Source§impl RdwHeader
impl RdwHeader
Sourcepub const fn from_bytes(bytes: [u8; 4]) -> Self
pub const fn from_bytes(bytes: [u8; 4]) -> Self
Construct from raw 4-byte header bytes.
Sourcepub fn from_payload_len(payload_len: usize, reserved: u16) -> Result<Self>
pub fn from_payload_len(payload_len: usize, reserved: u16) -> Result<Self>
Construct from payload length and reserved bytes.
§Errors
Returns CBKF102_RECORD_LENGTH_INVALID when payload_len > u16::MAX.
Sourcepub const fn looks_ascii_corrupt(self) -> bool
pub const fn looks_ascii_corrupt(self) -> bool
ASCII-corruption heuristic for the length bytes.
Returns true when both length bytes look like ASCII digits.
Trait Implementations§
impl Copy for RdwHeader
impl Eq for RdwHeader
impl StructuralPartialEq for RdwHeader
Auto Trait Implementations§
impl Freeze for RdwHeader
impl RefUnwindSafe for RdwHeader
impl Send for RdwHeader
impl Sync for RdwHeader
impl Unpin for RdwHeader
impl UnsafeUnpin for RdwHeader
impl UnwindSafe for RdwHeader
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.