MCPcopy Create free account
hub / github.com/bluejekyll/wasmtime-java / take

Method take

wasmtime-jni/src/opaque_ptr.rs:78–89  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76 /// It is undefined behavior to reference the ptr in any other context after this.
77 #[track_caller]
78 pub fn take(self) -> Box<T> {
79 trace!("{:?}::take", self);
80 assert_ne!(
81 self.ptr,
82 0,
83 "cannot deref null for &{}",
84 any::type_name::<T>()
85 );
86 let obj = self.ptr as *mut T;
87
88 unsafe { Box::from_raw(obj) }
89 }
90
91 /// Take ownership of a Rust type and return an opaque pointer as a jlong for future usage
92 pub fn make_opaque(self) -> jlong {

Calls

no outgoing calls

Tested by

no test coverage detected