github.com/primecitizens/pcz/std@v0.2.1/core/assert/bindings/ffi_bindings.ts (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 4 import { Application, Pointer, importModule } from "@ffi"; 5 6 importModule("core/assert", (A: Application) => { 7 let buf: string[] = []; 8 return { 9 "append": (pBytes: Pointer, len: number) => { 10 buf.push(A.load.String(pBytes, len)); 11 }, 12 "throw": () => { 13 const msg = buf.join(""); 14 buf.splice(0); 15 throw new Error(msg); 16 }, 17 }; 18 });