We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
take_rx()
1 parent 9b2337d commit 8c34978Copy full SHA for 8c34978
crates/ark/src/r_task.rs
@@ -52,20 +52,17 @@ impl TaskChannels {
52
self.tx.clone()
53
}
54
55
- fn take_rx(&self) -> Option<Receiver<RTask>> {
+ fn take_rx(&self) -> Receiver<RTask> {
56
let mut rx = self.rx.lock().unwrap();
57
- rx.take()
+ rx.take().expect("`take_rx()` can only be called once")
58
59
60
61
/// Returns receivers for both interrupt and idle tasks.
62
/// Initializes the task channels if they haven't been initialized yet.
63
/// Can only be called once (intended for `RMain` during init).
64
pub(crate) fn take_receivers() -> (Receiver<RTask>, Receiver<RTask>) {
65
- (
66
- INTERRUPT_TASKS.take_rx().unwrap(),
67
- IDLE_TASKS.take_rx().unwrap(),
68
- )
+ (INTERRUPT_TASKS.take_rx(), IDLE_TASKS.take_rx())
69
70
71
pub enum RTask {
0 commit comments