pollex/arm32/error/
arm_classify_error.rs

1// Copyright 2024-2025 Gabriel Bjørnager Jensen.
2//
3// This Source Code Form is subject to the terms of
4// the Mozilla Public License, version 2.0. If a
5// copy of the MPL was not distributed with this
6// file, you can obtain one at:
7// <https://mozilla.org/MPL/2.0/>.
8
9use core::convert::Infallible;
10use core::fmt::{self, Display, Formatter};
11
12/// An untagged Thumb opcode could not be classified.
13#[derive(Clone, Debug)]
14pub struct ArmClassifyError {
15	/// The invalid, untagged opcode.
16	pub raw_opcode: u32,
17}
18
19impl Display for ArmClassifyError {
20	#[inline]
21	fn fmt(&self, f: &mut Formatter) -> fmt::Result {
22		write!(f, "unable to classify arm opcode `{:#034b}`", self.raw_opcode)
23	}
24}
25
26impl core::error::Error for ArmClassifyError { }
27
28impl From<Infallible> for ArmClassifyError {
29	#[inline(always)]
30	fn from(_value: Infallible) -> Self {
31		unreachable!()
32	}
33}