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

Method into_anyhow

crates/core/src/error/error.rs:1691–1705  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1689
1690 #[cfg(feature = "anyhow")]
1691 pub(crate) fn into_anyhow(self) -> anyhow::Error {
1692 if self.is_oom() {
1693 // Safety: `self.is_oom()` is true.
1694 anyhow::Error::from(unsafe { *self.unchecked_oom() })
1695 } else {
1696 debug_assert!(self.is_boxed_dyn_error());
1697 // Safety: this is a boxed dyn error.
1698 let ptr = unsafe { self.unchecked_into_dyn_error() };
1699 // Safety: invariant of the type that the pointer is valid.
1700 let vtable = unsafe { ptr.as_ref().vtable };
1701 // Safety: the pointer is valid and the vtable is associated with
1702 // this pointer's concrete error type.
1703 unsafe { (vtable.into_anyhow)(ptr) }
1704 }
1705 }
1706
1707 fn source(&self) -> Option<&Error> {
1708 match self.unpack() {

Callers 1

fromMethod · 0.80

Calls 5

fromFunction · 0.85
unchecked_oomMethod · 0.80
is_oomMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected