Skip to main content

dope_core/executor/task/wait/
length.rs

1use std::mem;
2
3/// Number of waiters currently held by a queue.
4#[derive(Clone, Copy, Eq, PartialEq)]
5#[repr(transparent)]
6pub struct Length(usize);
7
8impl Length {
9    pub const ZERO: Self = Self(0);
10
11    pub(super) const fn new(waiters: usize) -> Self {
12        Self(waiters)
13    }
14
15    pub const fn get(self) -> usize {
16        self.0
17    }
18}
19
20const _: () = assert!(mem::size_of::<Length>() == mem::size_of::<usize>());