diff --git a/src/kernel/arch/x86_64/cpuid.rs b/src/kernel/arch/x86_64/cpuid.rs index 49bb183..729f9c8 100644 --- a/src/kernel/arch/x86_64/cpuid.rs +++ b/src/kernel/arch/x86_64/cpuid.rs @@ -3,6 +3,8 @@ #![allow(dead_code)] +use core::str::FromStr; + use lazy_static::lazy_static; use raw_cpuid::CpuId; use raw_cpuid::CpuIdReaderNative; @@ -86,6 +88,13 @@ impl TryFrom<&str> for ProcessorVendor { } } +impl FromStr for ProcessorVendor { + type Err = (); + fn from_str(s: &str) -> Result { + ProcessorVendor::try_from(s) + } +} + impl ProcessorVendor { pub fn is_hypervisor(&self) -> bool { matches!( diff --git a/src/kernel/log.rs b/src/kernel/log.rs index a7dcd28..cf6edb0 100644 --- a/src/kernel/log.rs +++ b/src/kernel/log.rs @@ -130,6 +130,13 @@ impl TryFrom<&str> for LogLevel { } } +impl core::str::FromStr for LogLevel { + type Err = EnumParseError; + fn from_str(value: &str) -> Result { + LogLevel::try_from(value) + } +} + impl From for String { fn from(from: LogLevel) -> String { match from {