Update a few examples.

This commit is contained in:
losfair 2019-10-08 23:01:03 +08:00
parent bd06aa02ba
commit 3778352d39
5 changed files with 23 additions and 2 deletions

4
Cargo.lock generated
View File

@ -610,6 +610,10 @@ dependencies = [
"unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hello_world"
version = "0.1.0"
[[package]]
name = "hex"
version = "0.3.2"

View File

@ -58,7 +58,8 @@ members = [
"lib/wasi-tests",
"lib/emscripten-tests",
"lib/middleware-common-tests",
"examples/plugin-for-example"
"examples/plugin-for-example",
"examples/hello_world"
]
[build-dependencies]

View File

@ -0,0 +1,9 @@
[package]
name = "hello_world"
version = "0.1.0"
authors = ["losfair <zhy20000919@hotmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -0,0 +1,7 @@
fn main() {
for i in 0..8 {
let s = format!("Hello, {}", i);
println!("{}", s);
}
panic!("OK");
}

View File

@ -20,7 +20,7 @@ fn main() {
let diff = millis - last_millis;
if diff >= 100 {
record_count += 1;
println!("{}", (i - round_count) as f64 / diff as f64);
println!("{}", ((i - round_count) as u128) * 1000000 / diff );
last_millis = millis;
round_count = i;
}