Files
chandra/interface/wasi-gfx/frame-buffer/frame-buffer/top.mbt
T
2026-11-25 02:54:03 +00:00

37 lines
976 B
MoonBit

// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
///|
pub(all) struct Buffer(Int) derive()
///|
/// Drops a resource handle.
pub fn Buffer::drop(self : Buffer) -> Unit {
let Buffer(resource) = self
wasmImportResourceDropBuffer(resource)
}
///|
/// TODO: This should be replaced with something that doesn't require a copy.
pub fn Buffer::get_with_copy(self : Buffer) -> FixedArray[Byte] {
let Buffer(handle) = self
let return_area = mbt_ffi_malloc(8)
wasmImportMethodBufferGetWithCopy(handle, return_area);
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
let ret = result
mbt_ffi_free(return_area)
return ret
}
///|
pub fn Buffer::set_with_copy(self : Buffer, val : FixedArray[Byte]) -> Unit {
let Buffer(handle) = self
let ptr = mbt_ffi_bytes2ptr(val)
wasmImportMethodBufferSetWithCopy(handle, ptr, val.length());
mbt_ffi_free(ptr)
}