mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-02 06:08:42 +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 {
|
pub enum LighthouseDriver {
|
||||||
|
#[default]
|
||||||
Vive,
|
Vive,
|
||||||
Survive,
|
Survive,
|
||||||
SteamVR,
|
SteamVR,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LighthouseDriver {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Vive
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<&str> for LighthouseDriver {
|
impl From<&str> for LighthouseDriver {
|
||||||
fn from(s: &str) -> Self {
|
fn from(s: &str) -> Self {
|
||||||
match s.trim().to_lowercase().as_str() {
|
match s.trim().to_lowercase().as_str() {
|
||||||
|
|
|
@ -5,19 +5,14 @@ use crate::{
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender};
|
use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum DeviceRowState {
|
pub enum DeviceRowState {
|
||||||
|
#[default]
|
||||||
Ok,
|
Ok,
|
||||||
Error,
|
Error,
|
||||||
Warning,
|
Warning,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DeviceRowState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Ok
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl DeviceRowState {
|
impl DeviceRowState {
|
||||||
pub fn icon(&self) -> &str {
|
pub fn icon(&self) -> &str {
|
||||||
match &self {
|
match &self {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use libmonado_rs::{self, BatteryStatus, DeviceRole};
|
use libmonado_rs::{self, BatteryStatus, DeviceRole};
|
||||||
use std::{collections::HashMap, fmt::Display, slice::Iter};
|
use std::{collections::HashMap, fmt::Display, slice::Iter};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum XRDeviceRole {
|
pub enum XRDeviceRole {
|
||||||
Head,
|
Head,
|
||||||
Eyes,
|
Eyes,
|
||||||
|
@ -25,15 +25,10 @@ pub enum XRDeviceRole {
|
||||||
Camera,
|
Camera,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
|
|
||||||
|
#[default]
|
||||||
GenericTracker,
|
GenericTracker,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for XRDeviceRole {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::GenericTracker
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for XRDeviceRole {
|
impl Display for XRDeviceRole {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
f.write_str(match self {
|
f.write_str(match self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue