From faffcb4e83f6cc76435bc4fe8f6a6cee789de374 Mon Sep 17 00:00:00 2001 From: able Date: Sun, 31 Jul 2022 00:58:16 -0500 Subject: [PATCH] update versioning to have a display impl --- Cargo.toml | 12 +++++++----- aos_wasm_stress_test/src/main.rs | 16 ++++++++++------ versioning/src/lib.rs | 9 ++++++++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 20e6fad..d12f6ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,11 @@ [workspace] members = [ - "axel", - "aos_wasm_stress_test", - "libwasm", - "pk_data", + # "axel", + # "aos_wasm_stress_test", + # "core_utils", + # "libwasm", + # "pk_data", "versioning", -] \ No newline at end of file + # "core_utils/list", +] diff --git a/aos_wasm_stress_test/src/main.rs b/aos_wasm_stress_test/src/main.rs index 7abe348..c363de8 100644 --- a/aos_wasm_stress_test/src/main.rs +++ b/aos_wasm_stress_test/src/main.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -use libwasm::driver::DriverExitCode; +use libwasm::{driver::DriverExitCode, get_input}; #[no_mangle] fn start() -> i32 { @@ -11,14 +11,18 @@ fn start() -> i32 { send_signal(PID(1), Signals::Quit); rand = get_random(); ret = 1; - let x = b"Hi there\n"; - for i in x { - print_char(*i as i32); + let mut input = [0; 32]; + let mut ind = 0; + loop { + let x = get_input(); + input[ind] = x; + if ind == 32 { + ind = 0; + } + ind += 1; } } - // rand as i32 - ret as i32 } diff --git a/versioning/src/lib.rs b/versioning/src/lib.rs index f59d7fd..d79481b 100644 --- a/versioning/src/lib.rs +++ b/versioning/src/lib.rs @@ -1,7 +1,7 @@ // ! A unified versioning system for Rust. #![no_std] -use core::prelude::rust_2021::derive; +use core::{fmt::Display, prelude::rust_2021::derive}; use serde::{Deserialize, Serialize}; @@ -11,3 +11,10 @@ pub struct Version { pub minor: u8, pub patch: u8, } + +impl Display for Version { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "v{}.{}.{}", self.major, self.minor, self.patch)?; + Ok(()) + } +}