mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
add a convenience method for creating messages
reduces the cognitive load of writing library functions
This commit is contained in:
parent
fe2a464dd2
commit
3c34517632
1 changed files with 12 additions and 0 deletions
|
|
@ -368,6 +368,18 @@ pub enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Message {
|
impl Message {
|
||||||
|
pub fn new_scalar(id: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) -> crate::Message {
|
||||||
|
Message::Scalar(crate::ScalarMessage {
|
||||||
|
id, arg1, arg2, arg3, arg4
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_blocking_scalar(id: usize, arg1: usize, arg2: usize, arg3: usize, arg4: usize) -> crate::Message {
|
||||||
|
Message::BlockingScalar(crate::ScalarMessage {
|
||||||
|
id, arg1, arg2, arg3, arg4
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Determine whether the specified Message will block
|
/// Determine whether the specified Message will block
|
||||||
pub fn is_blocking(&self) -> bool {
|
pub fn is_blocking(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue