mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-31 05:08:46 +00:00
fix: use default trait properly with enums
This commit is contained in:
parent
f8a18e96f0
commit
6feba023af
3 changed files with 6 additions and 21 deletions
|
@ -188,19 +188,14 @@ impl Default for ProfileFeatures {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum LighthouseDriver {
|
||||
#[default]
|
||||
Vive,
|
||||
Survive,
|
||||
SteamVR,
|
||||
}
|
||||
|
||||
impl Default for LighthouseDriver {
|
||||
fn default() -> Self {
|
||||
Self::Vive
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for LighthouseDriver {
|
||||
fn from(s: &str) -> Self {
|
||||
match s.trim().to_lowercase().as_str() {
|
||||
|
|
|
@ -5,19 +5,14 @@ use crate::{
|
|||
use adw::prelude::*;
|
||||
use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum DeviceRowState {
|
||||
#[default]
|
||||
Ok,
|
||||
Error,
|
||||
Warning,
|
||||
}
|
||||
|
||||
impl Default for DeviceRowState {
|
||||
fn default() -> Self {
|
||||
Self::Ok
|
||||
}
|
||||
}
|
||||
|
||||
impl DeviceRowState {
|
||||
pub fn icon(&self) -> &str {
|
||||
match &self {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use libmonado_rs::{self, BatteryStatus, DeviceRole};
|
||||
use std::{collections::HashMap, fmt::Display, slice::Iter};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum XRDeviceRole {
|
||||
Head,
|
||||
Eyes,
|
||||
|
@ -25,15 +25,10 @@ pub enum XRDeviceRole {
|
|||
Camera,
|
||||
Keyboard,
|
||||
|
||||
#[default]
|
||||
GenericTracker,
|
||||
}
|
||||
|
||||
impl Default for XRDeviceRole {
|
||||
fn default() -> Self {
|
||||
Self::GenericTracker
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for XRDeviceRole {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue