Skip to main content

mesh_api/
token.rs

1#[derive(Clone, Debug)]
2pub struct InviteToken(String);
3
4impl InviteToken {
5    pub fn as_str(&self) -> &str {
6        &self.0
7    }
8
9    pub(crate) fn into_inner(self) -> mesh_client::InviteToken {
10        mesh_client::InviteToken(self.0)
11    }
12}
13
14impl std::str::FromStr for InviteToken {
15    type Err = String;
16
17    fn from_str(s: &str) -> Result<Self, Self::Err> {
18        let token = s.parse::<mesh_client::InviteToken>()?;
19        Ok(Self(token.0))
20    }
21}