MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / is

Method is

crates/core/src/error/error.rs:937–952  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 ///

Callers

nothing calls this directly

Calls 4

anyMethod · 0.80
error_ext_chainMethod · 0.80
unpackMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected