From 11623a21831acd2767ddbff468234b874e621edd Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Wed, 1 Apr 2026 18:45:16 -0700 Subject: [PATCH] test_infra: Implement Display for GuestVmType Add Display trait implementation for GuestVmType to enable formatted output of the VM type in logs and diagnostics. Signed-off-by: Muminul Islam --- test_infra/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test_infra/src/lib.rs b/test_infra/src/lib.rs index d6e21cd5c..6a7225577 100644 --- a/test_infra/src/lib.rs +++ b/test_infra/src/lib.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; use std::ffi::OsStr; -use std::fmt::Display; +use std::fmt::{Display, Formatter}; use std::fs::OpenOptions; use std::io::{Read, Seek, SeekFrom, Write}; use std::net::{TcpListener, TcpStream}; @@ -2505,6 +2505,15 @@ impl FromStr for GuestVmType { } } +impl Display for GuestVmType { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { + match self { + GuestVmType::Regular => write!(f, "regular"), + GuestVmType::Confidential => write!(f, "confidential"), + } + } +} + // Get the direct igvm boot file path based on the console type fn direct_igvm_boot_path(console: Option<&str>) -> Option { // get the default hvc0 igvm file if console string is not passed