aboutsummaryrefslogtreecommitdiff
path: root/src/matchmaking.rs
diff options
context:
space:
mode:
authorMatthew Collins <[email protected]>2018-02-27 20:30:40 +0000
committerMatthew Collins <[email protected]>2018-02-27 20:30:40 +0000
commite99c0e0adc490b94b037838757bfa6647f3c3568 (patch)
tree1ab022877d951a111820b5c0a1d35facac3ef6ee /src/matchmaking.rs
parentAdd accessors for `SteamId`'s inner values (diff)
downloadsteamworks-rs-e99c0e0adc490b94b037838757bfa6647f3c3568.tar.xz
steamworks-rs-e99c0e0adc490b94b037838757bfa6647f3c3568.zip
Try and make the accessors generic over the client and server
Diffstat (limited to 'src/matchmaking.rs')
-rw-r--r--src/matchmaking.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/matchmaking.rs b/src/matchmaking.rs
index 27cf9e5..9ed8f8f 100644
--- a/src/matchmaking.rs
+++ b/src/matchmaking.rs
@@ -2,9 +2,9 @@
use super::*;
/// Access to the steam matchmaking interface
-pub struct Matchmaking {
+pub struct Matchmaking<Manager> {
pub(crate) mm: *mut sys::ISteamMatchmaking,
- pub(crate) client: Arc<ClientInner>,
+ pub(crate) inner: Arc<Inner<Manager>>,
}
const CALLBACK_BASE_ID: i32 = 500;
@@ -19,15 +19,15 @@ pub enum LobbyType {
#[derive(Debug)]
pub struct LobbyId(u64);
-impl Matchmaking {
+impl <Manager> Matchmaking<Manager> {
pub fn request_lobby_list<F>(&self, mut cb: F)
where F: FnMut(Result<Vec<LobbyId>, SteamError>) + 'static + Send + Sync
{
unsafe {
let api_call = sys::SteamAPI_ISteamMatchmaking_RequestLobbyList(self.mm);
- Client::register_call_result::<sys::LobbyMatchList, _>(
- &self.client, api_call, CALLBACK_BASE_ID + 10,
+ register_call_result::<sys::LobbyMatchList, _, _>(
+ &self.inner, api_call, CALLBACK_BASE_ID + 10,
move |v, io_error| {
cb(if io_error {
Err(SteamError::IOFailure)
@@ -53,8 +53,8 @@ impl Matchmaking {
LobbyType::Invisible => sys::LobbyType::Invisible,
};
let api_call = sys::SteamAPI_ISteamMatchmaking_CreateLobby(self.mm, ty, max_members as _);
- Client::register_call_result::<sys::LobbyCreated, _>(
- &self.client, api_call, CALLBACK_BASE_ID + 13,
+ register_call_result::<sys::LobbyCreated, _, _>(
+ &self.inner, api_call, CALLBACK_BASE_ID + 13,
move |v, io_error| {
cb(if io_error {
Err(SteamError::IOFailure)