rust: hpet: decode HPET registers into enums

Generalize timer_and_addr() to decode all registers into a single enum
HPETRegister, and use the TryInto derive to separate valid and
invalid values.

The main advantage lies in checking that all registers are enumerated
in the "match" statements.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2025-02-27 18:19:35 +01:00
parent aa50bc4fb9
commit 519088b7cf
3 changed files with 119 additions and 107 deletions

View file

@ -12,8 +12,6 @@
//! See [`PL011State`](crate::device::PL011State) for the device model type and
//! the [`registers`] module for register types.
#![allow(clippy::upper_case_acronyms)]
use qemu_api::c_str;
mod device;