o_sfu_protocol/core/
timers.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
4pub(super) struct RequestTimeoutId {
5 raw: u32,
6}
7
8impl RequestTimeoutId {
9 #[must_use]
10 const fn new(raw: u32) -> Self {
11 Self { raw }
12 }
13
14 #[must_use]
15 pub(super) const fn raw(self) -> u32 {
16 self.raw
17 }
18
19 #[must_use]
20 pub(super) const fn try_from_raw(raw: u32) -> Option<Self> {
21 if raw >= REQUEST_TIMEOUT_TIMER_BASE.raw {
22 Some(Self::new(raw))
23 } else {
24 None
25 }
26 }
27
28 #[must_use]
29 pub(super) const fn next(self) -> Self {
30 Self::new(self.raw.saturating_add(1))
31 }
32}
33
34pub(super) const REQUEST_TIMEOUT_TIMER_BASE: RequestTimeoutId = RequestTimeoutId::new(10_000);