Is this an `E` error? Returns true if any error in the context chain is an `E`. # Example ``` # use wasmtime_internal_core as wasmtime; use wasmtime::error::{Error, OutOfMemory}; let oom = Error::from(OutOfMemory::new(1234)); assert!(oom.is:: ()); assert!(!oom.is:: ()); // Here is an example with additional error context. let error = Error::from(u8::try_f
(&self)
| 935 | /// ); |
| 936 | /// ``` |
| 937 | pub fn is<E>(&self) -> bool |
| 938 | where |
| 939 | E: fmt::Display + fmt::Debug + Send + Sync + 'static, |
| 940 | { |
| 941 | self.error_ext_chain().any(|e| { |
| 942 | let result = e.inner.is::<E>(); |
| 943 | |
| 944 | #[cfg(feature = "anyhow")] |
| 945 | let result = result |
| 946 | || e.inner |
| 947 | .downcast_ref::<anyhow::Error>() |
| 948 | .is_some_and(|e| e.is::<E>()); |
| 949 | |
| 950 | result |
| 951 | }) |
| 952 | } |
| 953 | |
| 954 | /// Downcast this error into an `E`, taking ownership. |
| 955 | /// |
nothing calls this directly
no test coverage detected