fix: trait for profile feature type from str

This commit is contained in:
Gabriele Musco 2024-08-27 23:11:51 +02:00
commit 828343b8ea

View file

@ -88,17 +88,20 @@ pub enum ProfileFeatureType {
}
impl ProfileFeatureType {
pub fn from_string(s: String) -> Self {
pub fn iter() -> Iter<'static, ProfileFeatureType> {
[Self::Libsurvive, Self::Basalt].iter()
}
}
impl From<&str> for ProfileFeatureType {
fn from(s: &str) -> Self {
match s.trim().to_lowercase().as_str() {
"libsurvive" => Self::Libsurvive,
"basalt" => Self::Basalt,
"openhmd" => Self::OpenHmd,
_ => panic!("Unknown profile feature type"),
}
}
pub fn iter() -> Iter<'static, ProfileFeatureType> {
[Self::Libsurvive, Self::Basalt].iter()
}
}
impl Display for ProfileFeatureType {