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