Skip to content

Commit

Permalink
chore(release): 1.0.9 [skip ci]
Browse files Browse the repository at this point in the history
## [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
semantic-release-bot committed Sep 6, 2022
1 parent b541a3a commit 8d52e14
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flowscripter_template_deno_rust_library"
version ="1.0.8"
version ="1.0.9"
edition = "2021"
description = "Project template for a Rust library with Deno FFI bindings."
homepage = "https://github.com/flowscripter"
Expand Down
63 changes: 45 additions & 18 deletions bindings/bindings.ts
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
}

0 comments on commit 8d52e14

Please sign in to comment.