Skip to main content

wslplugins_rs/
session_id.rs

1use std::fmt::{self, Debug, Display};
2
3#[derive(Clone, Copy, PartialEq, Eq, Hash)]
4pub struct SessionID(pub u32);
5
6impl From<u32> for SessionID {
7    #[inline]
8    fn from(value: u32) -> Self {
9        Self(value)
10    }
11}
12
13impl From<SessionID> for u32 {
14    #[inline]
15    fn from(value: SessionID) -> Self {
16        value.0
17    }
18}
19
20impl Debug for SessionID {
21    #[inline]
22    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23        Debug::fmt(&self.0, f)
24    }
25}
26
27impl Display for SessionID {
28    #[inline]
29    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30        Display::fmt(&self.0, f)
31    }
32}