From 657294683b0975210f75955e5c36eb26a4b9902c Mon Sep 17 00:00:00 2001 From: Lennard Kittner Date: Sun, 8 Oct 2023 12:52:25 +0200 Subject: [PATCH] Replaced thiserror with thistermination --- ACKNOWLEDGEMENTS | 25 ------------------------- Cargo.toml | 8 ++++---- src/lib.rs | 14 +++++++------- 3 files changed, 11 insertions(+), 36 deletions(-) diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS index 5d9cae4..d974fdc 100644 --- a/ACKNOWLEDGEMENTS +++ b/ACKNOWLEDGEMENTS @@ -2,31 +2,6 @@ ksni: (https://crates.io/crates/ksni) -thiserror: -MIT License - -Copyright (c) [year] [fullname] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - hidapi: MIT License diff --git a/Cargo.toml b/Cargo.toml index 0822423..b44de8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "hyper_x_cloud_ii_wireless" -version = "1.0.0" +version = "1.0.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +thiserror = "1" hidapi = "2.3.3" -thiserror = "1.0.40" - -[target.'cfg(target_os = "linux")'.dependencies] +thistermination = "1.0.0" +[target.'cfg(unix)'.hyper_x_cloud_ii_wireless.dependencies] ksni = "0.2.0" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 960c496..67d86b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ use std::time::Duration; use hidapi::{HidApi, HidDevice, HidError}; -use thiserror::Error; +use thistermination::TerminationFull; // Possible vendor IDs [hyperx , HP] const VENDOR_IDS: [u16; 2] = [0x0951, 0x03F0]; @@ -54,17 +54,17 @@ impl DeviceEvent { } } -#[derive(Error, Debug)] +#[derive(TerminationFull)] pub enum DeviceError { - #[error("{0}")] + #[termination(msg("{0:?}"))] HidError(#[from] HidError), - #[error("No device found.")] + #[termination(msg("No device found."))] NoDeviceFound(), - #[error("No response. Is the headset turned on?")] + #[termination(msg("No response. Is the headset turned on?"))] HeadSetOff(), - #[error("No response.")] + #[termination(msg("No response."))] NoResponse(), - #[error("Unknown response: {0:?} with length: {1}")] + #[termination(msg("Unknown response: {0:?} with length: {1:?}"))] UnknownResponse([u8; 8], usize), }