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

Method debug

crates/core/src/error/error.rs:1828–1852  ·  view source on GitHub ↗
(&self, f: &mut fmt::Formatter<'_>)

Source from the content-addressed store, hash-verified

1826 }
1827
1828 fn debug(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1829 match self.unpack() {
1830 OomOrDynErrorRef::Oom(oom) => f.debug_tuple("Oom").field(oom).finish(),
1831 OomOrDynErrorRef::DynError(error) => {
1832 struct DebugError<'a>(SharedPtr<'a, DynError>);
1833 impl fmt::Debug for DebugError<'_> {
1834 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1835 // Safety: invariant of `OomOrDynError` that the pointer
1836 // is valid.
1837 let vtable = unsafe { self.0.as_ref().vtable };
1838 // Safety: the pointer is valid and the vtable is
1839 // associated with the pointer's concrete error type.
1840 unsafe { (vtable.debug)(self.0, f) }
1841 }
1842 }
1843
1844 let mut f = f.debug_struct("DynError");
1845 f.field("error", &DebugError(error));
1846 if let Some(source) = self.source() {
1847 f.field("source", &source);
1848 }
1849 f.finish()
1850 }
1851 }
1852 }
1853
1854 fn downcast_ref<E>(&self) -> Option<&E>
1855 where

Callers 1

fmtMethod · 0.45

Calls 5

DebugErrorClass · 0.85
unpackMethod · 0.45
finishMethod · 0.45
fieldMethod · 0.45
sourceMethod · 0.45

Tested by

no test coverage detected