mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-04 06:27:25 +00:00
kata-ctl: Implement Display trait for GuestProtection enum
Implement Display for enum to display in env output. Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
This commit is contained in:
parent
94a00f9346
commit
7565b33568
@ -8,6 +8,7 @@
|
|||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
use reqwest::header::{CONTENT_TYPE, USER_AGENT};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::fmt;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
#[cfg(any(target_arch = "x86_64"))]
|
#[cfg(any(target_arch = "x86_64"))]
|
||||||
@ -147,6 +148,19 @@ pub enum GuestProtection {
|
|||||||
Se,
|
Se,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for GuestProtection {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match self {
|
||||||
|
GuestProtection::Tdx => write!(f, "tdx"),
|
||||||
|
GuestProtection::Sev => write!(f, "sev"),
|
||||||
|
GuestProtection::Snp => write!(f, "snp"),
|
||||||
|
GuestProtection::Pef => write!(f, "pef"),
|
||||||
|
GuestProtection::Se => write!(f, "se"),
|
||||||
|
GuestProtection::NoProtection => write!(f, "none"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum ProtectionError {
|
pub enum ProtectionError {
|
||||||
|
Loading…
Reference in New Issue
Block a user