pub struct RawMrtRecord {
pub common_header: CommonHeader,
pub header_bytes: Bytes,
pub message_bytes: Bytes,
}Expand description
Raw MRT record containing the common header and unparsed message bytes. This allows for lazy parsing of the MRT message body, and provides utilities for debugging and exporting problematic records.
Fields§
§common_header: CommonHeader§header_bytes: BytesThe raw bytes of the MRT common header (as read from the wire).
message_bytes: BytesThe raw bytes of the MRT message body (excluding the common header).
Implementations§
Source§impl RawMrtRecord
impl RawMrtRecord
Sourcepub fn parse(self) -> Result<MrtRecord, ParserError>
pub fn parse(self) -> Result<MrtRecord, ParserError>
Parse the raw MRT record into a fully parsed MrtRecord. This consumes the RawMrtRecord and returns a MrtRecord.
Sourcepub fn raw_bytes(&self) -> Bytes
pub fn raw_bytes(&self) -> Bytes
Returns the complete MRT record as raw bytes (header + message body).
This returns the exact bytes as they were read from the wire, without any re-encoding. This is useful for debugging problematic MRT records by exporting them as-is to a file for further analysis.
§Example
let raw_record = parser.into_raw_record_iter().next().unwrap();
let bytes = raw_record.raw_bytes();
std::fs::write("record.mrt", &bytes).unwrap();Sourcepub fn write_raw_bytes<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn write_raw_bytes<P: AsRef<Path>>(&self, path: P) -> Result<()>
Writes the raw MRT record (header + message body) to a file.
This is useful for extracting problematic MRT records for debugging or further analysis with other tools.
§Arguments
path- The path to write the raw bytes to.
§Example
let raw_record = parser.into_raw_record_iter().next().unwrap();
raw_record.write_raw_bytes("problematic_record.mrt").unwrap();Sourcepub fn append_raw_bytes<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn append_raw_bytes<P: AsRef<Path>>(&self, path: P) -> Result<()>
Appends the raw MRT record (header + message body) to a file.
This is useful for collecting multiple problematic records into a single file.
§Arguments
path- The path to append the raw bytes to.
§Example
for raw_record in parser.into_raw_record_iter() {
if is_problematic(&raw_record) {
raw_record.append_raw_bytes("problematic_records.mrt").unwrap();
}
}Sourcepub fn total_bytes_len(&self) -> usize
pub fn total_bytes_len(&self) -> usize
Returns the total length of the complete MRT record in bytes (header + body).
Trait Implementations§
Source§impl Clone for RawMrtRecord
impl Clone for RawMrtRecord
Source§fn clone(&self) -> RawMrtRecord
fn clone(&self) -> RawMrtRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for RawMrtRecord
impl RefUnwindSafe for RawMrtRecord
impl Send for RawMrtRecord
impl Sync for RawMrtRecord
impl Unpin for RawMrtRecord
impl UnwindSafe for RawMrtRecord
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more