rust contract sample

This commit is contained in:
NikVolf
2017-04-13 01:03:41 +03:00
parent fe575b4eaa
commit 43130dd5c2
2 changed files with 49 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
#![feature(link_args)]
#![feature(lang_items)]
#![feature(drop_types_in_const)]
#![no_main]
#[link_args = "-s WASM=1 -s NO_EXIT_RUNTIME=1 -s NO_FILESYSTEM=1"]
extern {}
static mut DATA: Option<Vec<u8>> = None;
#[no_mangle]
pub fn call() {
let mut vec = Vec::new();
unsafe { if let Some(ref v) = DATA { vec.extend(v); }; }
vec.push(1u8);
unsafe {
DATA = Some(vec);
}
}