-
-
Save brson/9e2fdfd0199a60c23f8c14275c1fd537 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
target |
This file contains hidden or 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
[root] | |
name = "emtest" | |
version = "0.1.0" | |
dependencies = [ | |
"regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", | |
"semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "aho-corasick" | |
version = "0.5.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "kernel32-sys" | |
version = "0.2.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "lazy_static" | |
version = "0.2.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "libc" | |
version = "0.2.17" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "memchr" | |
version = "0.1.11" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "regex" | |
version = "0.1.80" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
"regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", | |
"thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", | |
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "regex-syntax" | |
version = "0.3.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "semver" | |
version = "0.5.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "semver-parser" | |
version = "0.6.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "thread-id" | |
version = "2.0.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "thread_local" | |
version = "0.2.7" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "utf8-ranges" | |
version = "0.1.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi" | |
version = "0.2.8" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "winapi-build" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[metadata] | |
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" | |
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" | |
"checksum lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6abe0ee2e758cd6bc8a2cd56726359007748fbf4128da998b65d0b70f881e19b" | |
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8" | |
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" | |
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" | |
"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" | |
"checksum semver 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae2ff60ecdb19c255841c066cbfa5f8c2a4ada1eb3ae47c77ab6667128da71f5" | |
"checksum semver-parser 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e88e43a5a74dd2a11707f9c21dfd4a423c66bd871df813227bb0a3e78f3a1ae9" | |
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" | |
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" | |
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" | |
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" | |
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" |
This file contains hidden or 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
[package] | |
name = "emtest" | |
version = "0.1.0" | |
authors = ["Brian Anderson <[email protected]>"] | |
[dependencies] | |
semver = "0.5.1" | |
regex = "0.1.80" | |
[[bin]] | |
name = "emtest" | |
path = "main.rs" | |
[profile.dev] | |
panic = "abort" | |
[profile.release] | |
panic = "abort" |
This file contains hidden or 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
#![feature(link_args)] | |
#[link_args = "-s EXPORTED_FUNCTIONS=['_hello_world']"] | |
#[link_args = "-s DEMANGLE_SUPPORT=1"] | |
#[link_args = "-s DEMANGLE_SUPPORT=1"] | |
extern {} | |
extern crate semver; | |
extern crate regex; | |
use semver::Version; | |
use semver::VersionReq; | |
#[no_mangle] | |
pub fn hello_world() -> bool { | |
// let r = VersionReq::parse(">= 1.0.0").unwrap(); | |
let v = Version::parse("1.0.0").unwrap(); | |
true | |
} | |
fn main() { | |
/* Intentionally left blank */ | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<script src="target/asmjs-unknown-emscripten/debug/emtest.js"></script> | |
<script> | |
var result = _hello_world(); | |
console.log("result: ", result); | |
</script> |
This file contains hidden or 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
var Module = require("./target/asmjs-unknown-emscripten/debug/emtest.js"); | |
var hello_world = Module.cwrap('hello_world', 'boolean', []); | |
var result = hello_world(); | |
console.log("result: ", result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment