Problem
After a message passes validation (ParsedMessage::Valid), required header fields like MsgSeqNum and MsgType are guaranteed to exist.
However, accessing them still returns Result, forcing call sites to handle impossible errors with expect() or propagate errors that can never occur.
Suggestion
The Header type could expose required fields as infallible accessors (e.g., header.msg_seq_num() -> u64) populated during parsing, while keeping the flexible .get() API for optional fields.
Problem
After a message passes validation (
ParsedMessage::Valid), required header fields likeMsgSeqNumandMsgTypeare guaranteed to exist.However, accessing them still returns
Result, forcing call sites to handle impossible errors withexpect()or propagate errors that can never occur.Suggestion
The
Headertype could expose required fields as infallible accessors (e.g.,header.msg_seq_num() -> u64) populated during parsing, while keeping the flexible.get()API for optional fields.