Replaced thiserror with thistermination
This commit is contained in:
@@ -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:
|
hidapi:
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "hyper_x_cloud_ii_wireless"
|
name = "hyper_x_cloud_ii_wireless"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
thiserror = "1"
|
||||||
hidapi = "2.3.3"
|
hidapi = "2.3.3"
|
||||||
thiserror = "1.0.40"
|
thistermination = "1.0.0"
|
||||||
|
[target.'cfg(unix)'.hyper_x_cloud_ii_wireless.dependencies]
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
ksni = "0.2.0"
|
ksni = "0.2.0"
|
||||||
14
src/lib.rs
14
src/lib.rs
@@ -1,7 +1,7 @@
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use hidapi::{HidApi, HidDevice, HidError};
|
use hidapi::{HidApi, HidDevice, HidError};
|
||||||
use thiserror::Error;
|
use thistermination::TerminationFull;
|
||||||
|
|
||||||
// Possible vendor IDs [hyperx , HP]
|
// Possible vendor IDs [hyperx , HP]
|
||||||
const VENDOR_IDS: [u16; 2] = [0x0951, 0x03F0];
|
const VENDOR_IDS: [u16; 2] = [0x0951, 0x03F0];
|
||||||
@@ -54,17 +54,17 @@ impl DeviceEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(TerminationFull)]
|
||||||
pub enum DeviceError {
|
pub enum DeviceError {
|
||||||
#[error("{0}")]
|
#[termination(msg("{0:?}"))]
|
||||||
HidError(#[from] HidError),
|
HidError(#[from] HidError),
|
||||||
#[error("No device found.")]
|
#[termination(msg("No device found."))]
|
||||||
NoDeviceFound(),
|
NoDeviceFound(),
|
||||||
#[error("No response. Is the headset turned on?")]
|
#[termination(msg("No response. Is the headset turned on?"))]
|
||||||
HeadSetOff(),
|
HeadSetOff(),
|
||||||
#[error("No response.")]
|
#[termination(msg("No response."))]
|
||||||
NoResponse(),
|
NoResponse(),
|
||||||
#[error("Unknown response: {0:?} with length: {1}")]
|
#[termination(msg("Unknown response: {0:?} with length: {1:?}"))]
|
||||||
UnknownResponse([u8; 8], usize),
|
UnknownResponse([u8; 8], usize),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user