-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [1.0.9](v1.0.8...v1.0.9) (2022-09-06) ### Bug Fixes * trying to force through updated deno_bindgen fixes [#19](#19) ([#49](#49)) ([b541a3a](b541a3a))
- Loading branch information
1 parent
b541a3a
commit 8d52e14
Showing
3 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,59 @@ | ||
// Auto-generated with deno_bindgen | ||
import { CachePolicy, prepare } from "https://deno.land/x/[email protected]/plug.ts"; | ||
import { CachePolicy, prepare } from "https://deno.land/x/[email protected]/plug.ts" | ||
|
||
function encode(v: string | Uint8Array): Uint8Array { | ||
if (typeof v !== "string") return v; | ||
return new TextEncoder().encode(v); | ||
if (typeof v !== "string") return v | ||
return new TextEncoder().encode(v) | ||
} | ||
|
||
function decode(v: Uint8Array): string { | ||
return new TextDecoder().decode(v); | ||
return new TextDecoder().decode(v) | ||
} | ||
|
||
function readPointer(v: any): Uint8Array { | ||
const ptr = new Deno.UnsafePointerView(v as Deno.UnsafePointer); | ||
const lengthBe = new Uint8Array(4); | ||
const view = new DataView(lengthBe.buffer); | ||
ptr.copyInto(lengthBe, 0); | ||
const buf = new Uint8Array(view.getUint32(0)); | ||
ptr.copyInto(buf, 4); | ||
return buf; | ||
const ptr = new Deno.UnsafePointerView(v as bigint) | ||
const lengthBe = new Uint8Array(4) | ||
const view = new DataView(lengthBe.buffer) | ||
ptr.copyInto(lengthBe, 0) | ||
const buf = new Uint8Array(view.getUint32(0)) | ||
ptr.copyInto(buf, 4) | ||
return buf | ||
} | ||
|
||
const url = new URL( | ||
"https://github.com/flowscripter/template-deno-rust-library/releases/download/v1.0.9", | ||
import.meta.url, | ||
) | ||
let uri = url.toString() | ||
if (!uri.endsWith("/")) uri += "/" | ||
|
||
let darwin: string | { aarch64: string; x86_64: string } = uri | ||
+ "libflowscripter_template_deno_rust_library.dylib" | ||
|
||
if (url.protocol !== "file:") { | ||
// Assume that remote assets follow naming scheme | ||
// for each macOS artifact. | ||
darwin = { | ||
aarch64: uri + "libflowscripter_template_deno_rust_library_arm64.dylib", | ||
x86_64: uri + "libflowscripter_template_deno_rust_library.dylib", | ||
} | ||
} | ||
|
||
const opts = { | ||
name: "flowscripter_template_deno_rust_library", | ||
url: (new URL("../target/debug", import.meta.url)).toString(), | ||
policy: CachePolicy.NONE, | ||
}; | ||
urls: { | ||
darwin, | ||
windows: uri + "flowscripter_template_deno_rust_library.dll", | ||
linux: uri + "libflowscripter_template_deno_rust_library.so", | ||
}, | ||
policy: undefined, | ||
} | ||
const _lib = await prepare(opts, { | ||
add: { parameters: ["i32", "i32"], result: "i32", nonblocking: false }, | ||
}); | ||
}) | ||
|
||
export function add(a0: number, a1: number) { | ||
let rawResult = _lib.symbols.add(a0, a1); | ||
const result = rawResult; | ||
return result; | ||
let rawResult = _lib.symbols.add(a0, a1) | ||
const result = rawResult | ||
return result | ||
} |