Skip to content

Commit

Permalink
fix: Change active profile to bool
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Nov 18, 2023
1 parent 4536c0a commit 4e8dbf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ReSet-Lib"
version = "0.2.9"
version = "0.3.0"
edition = "2021"
description = "Data structure library for ReSet"
repository = "https://github.com/Xetibo/ReSet-Lib"
Expand Down
21 changes: 8 additions & 13 deletions src/audio/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ pub struct Card {
pub index: u32,
pub name: String,
pub profiles: Vec<CardProfile>,
pub active_profile: String,
pub active_profile: bool,
}

impl Append for Card {
Expand All @@ -367,7 +367,7 @@ impl Append for Card {
impl<'a> Get<'a> for Card {
fn get(i: &mut arg::Iter<'a>) -> Option<Self> {
let (index, name, profiles, active_profile) =
<(u32, String, Vec<CardProfile>, String)>::get(i)?;
<(u32, String, Vec<CardProfile>, bool)>::get(i)?;
Some(Self {
index,
name,
Expand All @@ -380,12 +380,12 @@ impl<'a> Get<'a> for Card {
impl Arg for Card {
const ARG_TYPE: arg::ArgType = ArgType::Struct;
fn signature() -> Signature<'static> {
unsafe { Signature::from_slice_unchecked("(usa(ssb)s)\0") }
unsafe { Signature::from_slice_unchecked("(usa(ssb)b)\0") }
}
}

impl From<CardInfo<'_>> for Card {
fn from(value: CardInfo<'_>) -> Self {
impl From<&CardInfo<'_>> for Card {
fn from(value: &CardInfo<'_>) -> Self {
let name_opt = &value.name;
let name: String;
if name_opt.is_none() {
Expand All @@ -398,16 +398,11 @@ impl From<CardInfo<'_>> for Card {
for profile in value.profiles.iter() {
profiles.push(CardProfile::from(profile));
}
let active_profile: String;
let active_profile: bool;
if value.active_profile.is_some() {
active_profile = value
.active_profile
.unwrap()
.name
.unwrap_or_default()
.to_string();
active_profile = true;
} else {
active_profile = "".into();
active_profile = false;
}
Self {
index,
Expand Down

0 comments on commit 4e8dbf9

Please sign in to comment.