forked from able/aos_userland
update versioning to have a display impl
This commit is contained in:
parent
99b15238b6
commit
faffcb4e83
12
Cargo.toml
12
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",
|
||||
]
|
||||
# "core_utils/list",
|
||||
]
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue