update versioning to have a display impl

This commit is contained in:
able 2022-07-31 00:58:16 -05:00
parent 99b15238b6
commit faffcb4e83
3 changed files with 25 additions and 12 deletions

View file

@ -1,9 +1,11 @@
[workspace] [workspace]
members = [ members = [
"axel", # "axel",
"aos_wasm_stress_test", # "aos_wasm_stress_test",
"libwasm", # "core_utils",
"pk_data", # "libwasm",
# "pk_data",
"versioning", "versioning",
# "core_utils/list",
] ]

View file

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use libwasm::driver::DriverExitCode; use libwasm::{driver::DriverExitCode, get_input};
#[no_mangle] #[no_mangle]
fn start() -> i32 { fn start() -> i32 {
@ -11,14 +11,18 @@ fn start() -> i32 {
send_signal(PID(1), Signals::Quit); send_signal(PID(1), Signals::Quit);
rand = get_random(); rand = get_random();
ret = 1; ret = 1;
let x = b"Hi there\n"; let mut input = [0; 32];
for i in x { let mut ind = 0;
print_char(*i as i32); loop {
let x = get_input();
input[ind] = x;
if ind == 32 {
ind = 0;
}
ind += 1;
} }
} }
// rand as i32
ret as i32 ret as i32
} }

View file

@ -1,7 +1,7 @@
// ! A unified versioning system for Rust. // ! A unified versioning system for Rust.
#![no_std] #![no_std]
use core::prelude::rust_2021::derive; use core::{fmt::Display, prelude::rust_2021::derive};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -11,3 +11,10 @@ pub struct Version {
pub minor: u8, pub minor: u8,
pub patch: 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(())
}
}