Skip to main content

day_spec/controls/
pager.rs

1// Copyright © The Daybrite Project
2// SPDX-License-Identifier: MPL-2.0
3
4pub const KIND: &str = "day.piece.pager";
5#[derive(Clone, Debug, PartialEq, Eq, Default)]
6pub struct PagerState {
7    pub order: Vec<usize>,
8    pub selected: usize,
9    pub epoch: u64,
10}
11impl PagerState {
12    pub fn accepts(&self, epoch: u64, slot: usize) -> bool {
13        self.epoch == epoch && self.order.contains(&slot)
14    }
15}
16#[derive(Clone, Debug)]
17pub struct PagerProps {
18    pub slots: usize,
19}
20#[derive(Clone, Debug)]
21pub struct PagerPatch(pub PagerState);