You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
514 B
26 lines
514 B
//! Session for each connected user
|
|
use super::*;
|
|
|
|
id_type!(SessionID; "A unique session ID, not bound to a user.");
|
|
|
|
#[derive(Debug)]
|
|
pub struct Session
|
|
{
|
|
id: SessionID,
|
|
user: user::User,
|
|
}
|
|
|
|
impl Session
|
|
{
|
|
/// The randomly generated ID of this session, irrespective of the user of this session.
|
|
#[inline] pub fn session_id(&self) -> &SessionID
|
|
{
|
|
&self.id
|
|
}
|
|
/// The unique user ID of this session
|
|
pub fn user_id(&self) -> user::UserID
|
|
{
|
|
self.user.id_for_session(self)
|
|
}
|
|
}
|