From fc1aea2f96e3e926af51233c23219ca4c2376889 Mon Sep 17 00:00:00 2001 From: Gregor Reitzenstein Date: Wed, 2 Dec 2020 13:36:14 +0100 Subject: [PATCH] Shortcuts --- src/db/machine.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/db/machine.rs b/src/db/machine.rs index 4c47e54..8813978 100644 --- a/src/db/machine.rs +++ b/src/db/machine.rs @@ -79,6 +79,14 @@ impl MachineState { Self { state: Status::Free } } + pub fn free() -> Self { + Self { state: Status::Free } + } + + pub fn used(uid: UserId, priority: Priority) -> Self { + Self { state: Status::InUse(uid, priority) } + } + /// Check if the given priority is higher than one's own. /// /// If `self` does not have a priority then this function always returns `true`