From 5a0533d6bc3c6db78d09d0d556db4f7f99ab5d83 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 3 Mar 2021 21:16:45 +0800 Subject: [PATCH] xous: definitions: add Display to MemoryType Useful in debugging and error messages. Signed-off-by: Sean Cross --- xous-rs/src/definitions.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xous-rs/src/definitions.rs b/xous-rs/src/definitions.rs index d7ce1f3a4..b2b7b9b42 100644 --- a/xous-rs/src/definitions.rs +++ b/xous-rs/src/definitions.rs @@ -491,6 +491,17 @@ impl From for MemoryType { } } +impl core::fmt::Display for MemoryType { + fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + match *self { + MemoryType::Default => write!(fmt, "Default"), + MemoryType::Heap => write!(fmt, "Heap"), + MemoryType::Stack => write!(fmt, "Stack"), + MemoryType::Messages => write!(fmt, "Messages"), + } + } +} + #[repr(C)] #[derive(Debug, PartialEq)] pub enum Result {