pub type TokenTable<Id> = HashMap<RawToken, InstanceAccessDetails<Id>>;
-pub trait AccessId : Copy + Clone + 'static {
- type Error : Into<OnlineError>;
+pub trait AccessId: Copy + Clone + 'static {
+ type Error: Into<OnlineError>;
const ERROR : Self::Error;
fn global_tokens(_:PrivateCaller) -> &'static RwLock<TokenTable<Self>>;
fn tokens_registry(ig: &mut Instance, _:PrivateCaller)
impl AccessId for PlayerId {
type Error = PlayerNotFound;
- const ERROR : PlayerNotFound = PlayerNotFound;
+ const ERROR: PlayerNotFound = PlayerNotFound;
fn global_tokens(_: PrivateCaller) -> &'static RwLock<TokenTable<Self>> {
&GLOBAL.players
}
}
impl AccessId for ClientId {
type Error = OnlineError;
- const ERROR : OnlineError = NoClient;
+ const ERROR: OnlineError = NoClient;
fn global_tokens(_: PrivateCaller) -> &'static RwLock<TokenTable<Self>> {
&GLOBAL.clients
}
#[throws(OE)]
pub fn record_token<Id : AccessId> (
- ig : &mut InstanceGuard,
- iad : InstanceAccessDetails<Id>
+ ig: &mut InstanceGuard,
+ iad: InstanceAccessDetails<Id>
) -> RawToken {
let token = RawToken::new_random();
ig.token_register(token.clone(), iad);