multiversx_sc_wasm_adapter/api/
endpoint_finish_api_node.rsuse super::VmApiImpl;
use multiversx_sc::api::{EndpointFinishApi, EndpointFinishApiImpl};
extern "C" {
fn finish(dataOffset: *const u8, length: i32);
fn bigIntFinishUnsigned(bih: i32);
fn bigIntFinishSigned(bih: i32);
fn smallIntFinishUnsigned(value: i64);
fn smallIntFinishSigned(value: i64);
fn mBufferFinish(mBufferHandle: i32) -> i32;
}
impl EndpointFinishApi for VmApiImpl {
type EndpointFinishApiImpl = VmApiImpl;
#[inline]
fn finish_api_impl() -> Self::EndpointFinishApiImpl {
VmApiImpl {}
}
}
impl EndpointFinishApiImpl for VmApiImpl {
#[inline]
fn finish_slice_u8(&self, slice: &[u8]) {
unsafe {
finish(slice.as_ptr(), slice.len() as i32);
}
}
#[inline]
fn finish_big_int_raw(&self, handle: Self::BigIntHandle) {
unsafe {
bigIntFinishSigned(handle);
}
}
#[inline]
fn finish_big_uint_raw(&self, handle: Self::BigIntHandle) {
unsafe {
bigIntFinishUnsigned(handle);
}
}
#[inline]
fn finish_managed_buffer_raw(&self, handle: Self::ManagedBufferHandle) {
unsafe {
mBufferFinish(handle);
}
}
#[inline]
fn finish_u64(&self, value: u64) {
unsafe {
smallIntFinishUnsigned(value as i64);
}
}
#[inline]
fn finish_i64(&self, value: i64) {
unsafe {
smallIntFinishSigned(value);
}
}
}