From 81a927e31f203e70e26ce2c3f3e3481f83199ce6 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Tue, 22 Sep 2020 21:24:48 +0800 Subject: [PATCH] xous: definitions: Message: add has_memory() This function can be used to determine if a function has any memory attached to the message. Signed-off-by: Sean Cross --- xous-rs/src/definitions.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xous-rs/src/definitions.rs b/xous-rs/src/definitions.rs index 67f859dc2..67126e513 100644 --- a/xous-rs/src/definitions.rs +++ b/xous-rs/src/definitions.rs @@ -297,6 +297,14 @@ impl Message { Message::Move(_) | Message::Scalar(_) => false, } } + + /// Determine whether the specified message has data attached + pub fn has_memory(&self) -> bool { + match *self { + Message::MutableBorrow(_) | Message::Borrow(_) | Message::Move(_) => true, + Message::BlockingScalar(_) | Message::Scalar(_) => false, + } + } } #[repr(C)]