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]
members = [
"axel",
"aos_wasm_stress_test",
"libwasm",
"pk_data",
# "axel",
# "aos_wasm_stress_test",
# "core_utils",
# "libwasm",
# "pk_data",
"versioning",
]
# "core_utils/list",
]

View file

@ -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
}

View file

@ -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(())
}
}