Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,20 @@ impl std::fmt::Display for KeybdKey {
#[derive(Debug, Error)]
pub enum ParseError {
#[error("Unable to parse the keycode value")]
ParseIntError {
#[from]
source: std::num::ParseIntError,
backtrace: std::backtrace::Backtrace,
},
ParseIntError,
#[error("Unknown format '{val}'")]
UnknownFormat {
val: String,
backtrace: std::backtrace::Backtrace,
},
}

#[cfg(feature = "serde")]
impl From<std::num::ParseIntError> for ParseError {
fn from(_: std::num::ParseIntError) -> Self {
return ParseError::ParseIntError
}
}

#[cfg(feature = "serde")]
impl std::str::FromStr for KeybdKey {
type Err = ParseError;
Expand All @@ -498,8 +500,7 @@ impl std::str::FromStr for KeybdKey {
}

Err(ParseError::UnknownFormat {
val: s.to_string(),
backtrace: std::backtrace::Backtrace::capture(),
val: s.to_string()
})
}
}
Expand Down Expand Up @@ -622,8 +623,7 @@ impl std::str::FromStr for MouseButton {
}

Err(ParseError::UnknownFormat {
val: s.to_string(),
backtrace: std::backtrace::Backtrace::capture(),
val: s.to_string()
})
}
}
Expand Down