mirror of
https://github.com/haraldh/chainerror.git
synced 2025-02-23 08:44:20 +01:00
fixed filter() and filter_map() calls
This commit is contained in:
parent
d14af67560
commit
e7d4afb86c
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "chainerror"
|
name = "chainerror"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
authors = ["Harald Hoyer <harald@redhat.com>"]
|
authors = ["Harald Hoyer <harald@redhat.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
|
|
|
@ -266,7 +266,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
|
||||||
~~~
|
~~~
|
||||||
**/
|
**/
|
||||||
pub fn find_cause<U: Error + 'static>(&self) -> Option<&U> {
|
pub fn find_cause<U: Error + 'static>(&self) -> Option<&U> {
|
||||||
self.iter().filter_map(Error::downcast_ref::<U>()).next()
|
self.iter().filter_map(Error::downcast_ref::<U>).next()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** find the first error cause of type ChainError<U>, if any exists
|
/** find the first error cause of type ChainError<U>, if any exists
|
||||||
|
@ -286,7 +286,7 @@ impl<T: 'static + Display + Debug> ChainError<T> {
|
||||||
**/
|
**/
|
||||||
pub fn find_chain_cause<U: Error + 'static>(&self) -> Option<&ChainError<U>> {
|
pub fn find_chain_cause<U: Error + 'static>(&self) -> Option<&ChainError<U>> {
|
||||||
self.iter()
|
self.iter()
|
||||||
.filter_map(Error::downcast_ref::<ChainError<U>>())
|
.filter_map(Error::downcast_ref::<ChainError<U>>)
|
||||||
.next()
|
.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue