leptos_use/core/
reconnect_limit.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum ReconnectLimit {
    Infinite,
    Limited(u64),
}

impl Default for ReconnectLimit {
    fn default() -> Self {
        ReconnectLimit::Limited(3)
    }
}

impl ReconnectLimit {
    pub fn is_exceeded_by(self, times: u64) -> bool {
        match self {
            ReconnectLimit::Infinite => false,
            ReconnectLimit::Limited(limit) => times >= limit,
        }
    }
}