Files
tauri-plugins-workspace/plugins/global-shortcut/src/error.rs
T
renovate[bot] 78a4097d09 fix(deps): update rust crate global-hotkey to 0.5.1 (#1211)
* fix(deps): update rust crate global-hotkey to 0.5.1

* fix comp

* Update Cargo.toml

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: FabianLars <fabianlars@fabianlars.de>
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
2024-04-18 17:05:15 +02:00

33 lines
834 B
Rust

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use serde::{Serialize, Serializer};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("{0}")]
GlobalHotkey(String),
}
impl Serialize for Error {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(self.to_string().as_ref())
}
}
impl From<global_hotkey::Error> for Error {
fn from(value: global_hotkey::Error) -> Self {
Self::GlobalHotkey(value.to_string())
}
}
impl From<global_hotkey::hotkey::HotKeyParseError> for Error {
fn from(value: global_hotkey::hotkey::HotKeyParseError) -> Self {
Self::GlobalHotkey(value.to_string())
}
}