remove expect
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
4edcf4c412
commit
97718b33a6
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -5386,7 +5386,7 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tfc"
|
name = "tfc"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
source = "git+https://github.com/asur4s/The-Fat-Controller#48303c5dacded6ea1873bc5d69bdde3175cf336a"
|
source = "git+https://github.com/fufesou/The-Fat-Controller#48303c5dacded6ea1873bc5d69bdde3175cf336a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-graphics 0.22.3",
|
"core-graphics 0.22.3",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
|
@ -23,7 +23,7 @@ serde = { version = "1.0", optional = true }
|
|||||||
serde_derive = { version = "1.0", optional = true }
|
serde_derive = { version = "1.0", optional = true }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
rdev = { git = "https://github.com/fufesou/rdev" }
|
rdev = { git = "https://github.com/fufesou/rdev" }
|
||||||
tfc = { git = "https://github.com/asur4s/The-Fat-Controller" }
|
tfc = { git = "https://github.com/fufesou/The-Fat-Controller" }
|
||||||
hbb_common = { path = "../hbb_common" }
|
hbb_common = { path = "../hbb_common" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
@ -447,8 +447,9 @@ pub trait KeyboardControllable {
|
|||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
self.key_sequence_parse_try(sequence)
|
if let Err(..) = self.key_sequence_parse_try(sequence) {
|
||||||
.expect("Could not parse sequence");
|
println!("Could not parse sequence");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// Same as key_sequence_parse except returns any errors
|
/// Same as key_sequence_parse except returns any errors
|
||||||
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), dsl::ParseError>
|
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), dsl::ParseError>
|
||||||
|
@ -88,7 +88,13 @@ impl Default for Enigo {
|
|||||||
Self {
|
Self {
|
||||||
is_x11,
|
is_x11,
|
||||||
tfc: if is_x11 {
|
tfc: if is_x11 {
|
||||||
Some(TFC_Context::new().expect("kbd context error"))
|
match TFC_Context::new() {
|
||||||
|
Ok(ctx) => Some(ctx),
|
||||||
|
Err(..) => {
|
||||||
|
println!("kbd context error");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
@ -391,8 +391,9 @@ impl KeyboardControllable for EnigoXdo {
|
|||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
self.key_sequence_parse_try(sequence)
|
if let Err(..) = self.key_sequence_parse_try(sequence) {
|
||||||
.expect("Could not parse sequence");
|
println!("Could not parse sequence");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), crate::dsl::ParseError>
|
fn key_sequence_parse_try(&mut self, sequence: &str) -> Result<(), crate::dsl::ParseError>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user