mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
kernel: services: implement Debug for ProcessState
This gives us prettier and more useful displays for ProcessState. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5a0533d6bc
commit
cc4c0f3c58
1 changed files with 15 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ pub struct SystemServices {
|
|||
_syscall_depth: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum ProcessState {
|
||||
/// This is an unallocated, free process
|
||||
Free,
|
||||
|
|
@ -62,6 +62,20 @@ pub enum ProcessState {
|
|||
Sleeping,
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for ProcessState {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::result::Result<(), core::fmt::Error> {
|
||||
use ProcessState::*;
|
||||
match *self {
|
||||
Free => write!(fmt, "Free"),
|
||||
Allocated => write!(fmt, "Allocated"),
|
||||
Setup(ti) => write!(fmt, "Setup({:?})", ti),
|
||||
Ready(rt) => write!(fmt, "Ready({:b})", rt),
|
||||
Running(rt) => write!(fmt, "Running({:b})", rt),
|
||||
Sleeping => write!(fmt, "Sleeping"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ProcessState {
|
||||
fn default() -> ProcessState {
|
||||
ProcessState::Free
|
||||
|
|
|
|||
Loading…
Reference in a new issue