From 4592f12349cbfc703f3f00e5b0d753ef225e25de Mon Sep 17 00:00:00 2001 From: Brooks J Rady Date: Mon, 11 Jan 2021 06:02:59 +0000 Subject: [PATCH] Add a new host function --- Cargo.toml | 2 +- src/shim.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 24ca614e..3fa27a26 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mosaic-tile" -version = "0.2.2" +version = "0.3.0" authors = ["Brooks J Rady "] edition = "2018" description = "A small client-side library for writing mosaic plugins (tiles)" diff --git a/src/shim.rs b/src/shim.rs index 070b6d2b..60bdfbd5 100644 --- a/src/shim.rs +++ b/src/shim.rs @@ -34,7 +34,13 @@ pub fn open_file(path: &Path) { unsafe { host_open_file() }; } +pub fn set_selectable(selectable: bool) { + let selectable = if selectable { 1 } else { 0 }; + unsafe { host_set_selectable(selectable) }; +} + #[link(wasm_import_module = "mosaic")] extern "C" { fn host_open_file(); + fn host_set_selectable(selectable: i32); }