Implement std::fmt::Pointer for ExternRef (#4504)
This commit is contained in:
@@ -165,6 +165,12 @@ use wasmtime_environ::StackMap;
|
|||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct VMExternRef(NonNull<VMExternData>);
|
pub struct VMExternRef(NonNull<VMExternData>);
|
||||||
|
|
||||||
|
impl std::fmt::Pointer for VMExternRef {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
std::fmt::Pointer::fmt(&self.0, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Data contained is always Send+Sync so these should be safe.
|
// Data contained is always Send+Sync so these should be safe.
|
||||||
unsafe impl Send for VMExternRef {}
|
unsafe impl Send for VMExternRef {}
|
||||||
unsafe impl Sync for VMExternRef {}
|
unsafe impl Sync for VMExternRef {}
|
||||||
|
|||||||
@@ -100,3 +100,9 @@ impl ExternRef {
|
|||||||
externref_ptr as usize
|
externref_ptr as usize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Pointer for ExternRef {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
std::fmt::Pointer::fmt(&self.inner, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user