Parses a `RawRecord` using a `varfmt` function that takes into account the endianness of the architecture.
(&self, raw: RawRecord<'a>)
| 2028 | /// Parses a `RawRecord` using a `varfmt` function that takes into account the endianness of the |
| 2029 | /// architecture. |
| 2030 | pub fn parse_record<'a>(&self, raw: RawRecord<'a>) -> Result<Record<'a>, Error> { |
| 2031 | let varfmt = match self { |
| 2032 | Self::X86 => super::parse_le32, |
| 2033 | Self::X86_64 => super::parse_le64, |
| 2034 | Self::X86_64Compat32 => super::parse_le64, |
| 2035 | Self::PowerPc => super::parse_be32, |
| 2036 | Self::PowerPc64 => super::parse_be64, |
| 2037 | Self::Arm => super::parse_be32, |
| 2038 | Self::Arm64 => super::parse_be64, |
| 2039 | Self::M68k => super::parse_be32, |
| 2040 | Self::Mips => super::parse_be32, |
| 2041 | Self::Mips64 => super::parse_be64, |
| 2042 | Self::Mipsel => super::parse_le32, |
| 2043 | Self::Mipsel64 => super::parse_le64, |
| 2044 | Self::Sparc => super::parse_be32, |
| 2045 | Self::Sparc64 => super::parse_be64, |
| 2046 | Self::RiscV => super::parse_le32, |
| 2047 | Self::RiscV64 => super::parse_le64, |
| 2048 | Self::Unknown(n) => return Err(Error::UnknownArch(*n)), |
| 2049 | }; |
| 2050 | |
| 2051 | Record::parse(raw, varfmt) |
| 2052 | .map_err(move |e| Error::ParseRecord(e.to_string(), Box::new(Error::NoData))) |
| 2053 | } |
| 2054 | } |
| 2055 | |
| 2056 | // NOTE: Below I import the Architecture enum from dataflow along with all of the |