mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-04-30 14:08:00 +00:00
rust contract sample
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user