mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-01 13:48:47 +00:00
fix: trait for profile feature type from str
This commit is contained in:
parent
de4aebd40f
commit
828343b8ea
1 changed files with 8 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue