utils_macros: Implement derive_control_flag

Add a new derive macro 'derive_control_flag' that is used in the next
commit to reimplement how the code deals with Secure Execution control
flags.

It implements Display, IntoEnumIterator and the ControlFlagTrait for
enums using unit variants only.

  /// Trait for control flags that provide bit position information.
  pub trait ControlFlagTrait {
      /// Returns the bit position for this flag.
      fn bit_position(self) -> u8;
  }

Assisted-by: IBM Bob:1.0.4
Signed-off-by: Marc Hartmayer <marc@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2026-06-22 17:26:31 +02:00
committed by Steffen Eiden
parent 618e22e38b
commit 2d330cd45f
4 changed files with 406 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ mod tmpfile;
pub use ::log::LevelFilter;
// Re-export procedural macros from utils_macros
pub use utils_macros::{ValueEnumDisplay, ValueEnumFromStr};
pub use utils_macros::{ControlFlag, ValueEnumDisplay, ValueEnumFromStr};
pub use crate::cli::{
combined_path_opt, combined_path_req, get_reader_from_cli_file_arg,