Skip to main content

latch_core/
session.rs

1use serde::{Deserialize, Serialize};
2use std::fmt::{Display, Formatter};
3
4#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
5pub struct SessionId(pub String);
6
7impl SessionId {
8    pub fn new(value: impl Into<String>) -> Self {
9        Self(value.into())
10    }
11}
12
13impl Display for SessionId {
14    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
15        f.write_str(&self.0)
16    }
17}
18
19impl AsRef<str> for SessionId {
20    fn as_ref(&self) -> &str {
21        &self.0
22    }
23}