mirror of https://github.com/tildeio/helix
Merge branch 'master' into ruby-namespace
This commit is contained in:
commit
38839481eb
|
@ -17,11 +17,7 @@ impl<'a> UncheckedValue<bool> for Value<'a> {
|
|||
|
||||
impl<'a> ToRust<bool> for CheckedValue<'a, bool> {
|
||||
fn to_rust(self) -> bool {
|
||||
if unsafe { self.inner.inner() == Qtrue } {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
unsafe { self.inner.inner() == Qtrue }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
29
src/lib.rs
29
src/lib.rs
|
@ -109,20 +109,21 @@ impl ExceptionInfo {
|
|||
}
|
||||
|
||||
pub fn from_any(any: Box<std::any::Any>) -> ExceptionInfo {
|
||||
match any.downcast_ref::<ExceptionInfo>() {
|
||||
Some(e) => *e,
|
||||
None => {
|
||||
match any.downcast_ref::<&'static str>() {
|
||||
Some(e) => ExceptionInfo::with_message(e.to_string()),
|
||||
None => {
|
||||
match any.downcast_ref::<String>() {
|
||||
Some(e) => ExceptionInfo::with_message(e.as_str()),
|
||||
None => ExceptionInfo::with_message(format!("Unknown Error; err={:?}", any)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
any.downcast_ref::<ExceptionInfo>()
|
||||
.map(|e| *e)
|
||||
.or_else(||
|
||||
any.downcast_ref::<&'static str>()
|
||||
.map(|e| e.to_string())
|
||||
.map(ExceptionInfo::with_message)
|
||||
)
|
||||
.or_else(||
|
||||
any.downcast_ref::<String>()
|
||||
.map(|e| e.as_str())
|
||||
.map(ExceptionInfo::with_message)
|
||||
)
|
||||
.unwrap_or_else(||
|
||||
ExceptionInfo::with_message(format!("Unknown Error; err={:?}", any))
|
||||
)
|
||||
}
|
||||
|
||||
pub fn message(&self) -> VALUE {
|
||||
|
|
Loading…
Reference in New Issue