id : PhantomData<Id>,
}
-// ---------- Token Table API ----------
-
#[derive(Clone,Debug)]
pub struct InstanceAccessDetails<Id> {
pub gref : InstanceRef,
pub i : InstanceAccessDetails<Id>,
}
-pub type TokenTable<Id> = HashMap<RawToken, InstanceAccessDetails<Id>>;
-
-pub trait AccessId : Copy + Clone + 'static {
- fn global_tokens(_:PrivateCaller) -> &'static RwLock<TokenTable<Self>>;
- fn tokens_registry(ig: &mut Instance, _:PrivateCaller)
- -> &mut TokenRegistry<Self>;
- const ERROR : OnlineError;
-}
-
-pub struct PrivateCaller(());
-// outsiders cannot construct this
-// workaround for inability to have private trait methods
-const PRIVATE_Y : PrivateCaller = PrivateCaller(());
-
// ========== internal data structures ==========
lazy_static! {
fn from(_: PoisonError<X>) -> Self { Self::GameCorrupted }
}
+pub struct PrivateCaller(());
+// outsiders cannot construct this
+// workaround for inability to have private trait methods
+const PRIVATE_Y : PrivateCaller = PrivateCaller(());
+
// ========== implementations ==========
impl Borrow<str> for RawToken {
}
}
-// ---------- Lookup and token API ----------
+// ---------- Tokens / TokenTable / AccessId ----------
+
+pub type TokenTable<Id> = HashMap<RawToken, InstanceAccessDetails<Id>>;
+
+pub trait AccessId : Copy + Clone + 'static {
+ fn global_tokens(_:PrivateCaller) -> &'static RwLock<TokenTable<Self>>;
+ fn tokens_registry(ig: &mut Instance, _:PrivateCaller)
+ -> &mut TokenRegistry<Self>;
+ const ERROR : OnlineError;
+}
impl AccessId for PlayerId {
const ERROR : OnlineError = NoPlayer;