diff options
| author | Matthew Collins <[email protected]> | 2020-06-21 20:10:56 +0100 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2020-06-21 20:10:56 +0100 |
| commit | f0a4d2472820d5592cef9d3f4cb57c8ba17e5b2b (patch) | |
| tree | 1c72dd026e7015da9a45f32a4427834bc23d9d09 /src/matchmaking.rs | |
| parent | Merge pull request #23 from wyozi/patch-1 (diff) | |
| download | steamworks-rs-f0a4d2472820d5592cef9d3f4cb57c8ba17e5b2b.tar.xz steamworks-rs-f0a4d2472820d5592cef9d3f4cb57c8ba17e5b2b.zip | |
Use `Fn` instead of `FnMut` for call results as they will be called at most once
Diffstat (limited to 'src/matchmaking.rs')
| -rw-r--r-- | src/matchmaking.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/matchmaking.rs b/src/matchmaking.rs index ed4cd57..3145e2f 100644 --- a/src/matchmaking.rs +++ b/src/matchmaking.rs @@ -44,8 +44,8 @@ impl LobbyId { impl <Manager> Matchmaking<Manager> { - pub fn request_lobby_list<F>(&self, mut cb: F) - where F: FnMut(SResult<Vec<LobbyId>>) + 'static + Send + pub fn request_lobby_list<F>(&self, cb: F) + where F: Fn(SResult<Vec<LobbyId>>) + 'static + Send { unsafe { let api_call = sys::SteamAPI_ISteamMatchmaking_RequestLobbyList(self.mm); @@ -76,8 +76,8 @@ impl <Manager> Matchmaking<Manager> { /// /// * `LobbyEnter` /// * `LobbyCreated` - pub fn create_lobby<F>(&self, ty: LobbyType, max_members: u32, mut cb: F) - where F: FnMut(SResult<LobbyId>) + 'static + Send + pub fn create_lobby<F>(&self, ty: LobbyType, max_members: u32, cb: F) + where F: Fn(SResult<LobbyId>) + 'static + Send { assert!(max_members <= 250); // Steam API limits unsafe { @@ -104,8 +104,8 @@ impl <Manager> Matchmaking<Manager> { } /// Tries to join the lobby with the given ID - pub fn join_lobby<F>(&self, lobby: LobbyId, mut cb: F) - where F: FnMut(Result<LobbyId, ()>) + 'static + Send + pub fn join_lobby<F>(&self, lobby: LobbyId, cb: F) + where F: Fn(Result<LobbyId, ()>) + 'static + Send { unsafe { let api_call = sys::SteamAPI_ISteamMatchmaking_JoinLobby(self.mm, lobby.0); |