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/user_stats.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/user_stats.rs')
| -rw-r--r-- | src/user_stats.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/user_stats.rs b/src/user_stats.rs index 000ffab..d085313 100644 --- a/src/user_stats.rs +++ b/src/user_stats.rs @@ -16,8 +16,8 @@ const CALLBACK_BASE_ID: i32 = 1100; impl <Manager> UserStats<Manager> { - pub fn find_leaderboard<F>(&self, name: &str, mut cb: F) - where F: FnMut(Result<Option<Leaderboard>, SteamError>) + 'static + Send + pub fn find_leaderboard<F>(&self, name: &str, cb: F) + where F: Fn(Result<Option<Leaderboard>, SteamError>) + 'static + Send { unsafe { let name = CString::new(name).unwrap(); @@ -38,8 +38,8 @@ impl <Manager> UserStats<Manager> { } } - pub fn find_or_create_leaderboard<F>(&self, name: &str, sort_method: LeaderboardSortMethod, display_type: LeaderboardDisplayType, mut cb: F) - where F: FnMut(Result<Option<Leaderboard>, SteamError>) + 'static + Send + pub fn find_or_create_leaderboard<F>(&self, name: &str, sort_method: LeaderboardSortMethod, display_type: LeaderboardDisplayType, cb: F) + where F: Fn(Result<Option<Leaderboard>, SteamError>) + 'static + Send { unsafe { let name = CString::new(name).unwrap(); @@ -73,8 +73,8 @@ impl <Manager> UserStats<Manager> { } } - pub fn upload_leaderboard_score<F>(&self, leaderboard: &Leaderboard, method: UploadScoreMethod, score: i32, details: &[i32], mut cb: F) - where F: FnMut(Result<Option<LeaderboardScoreUploaded>, SteamError>) + 'static + Send + pub fn upload_leaderboard_score<F>(&self, leaderboard: &Leaderboard, method: UploadScoreMethod, score: i32, details: &[i32], cb: F) + where F: Fn(Result<Option<LeaderboardScoreUploaded>, SteamError>) + 'static + Send { unsafe { let method = match method { @@ -108,9 +108,9 @@ impl <Manager> UserStats<Manager> { leaderboard: &Leaderboard, request: LeaderboardDataRequest, start: usize, end: usize, max_details_len: usize, - mut cb: F + cb: F ) - where F: FnMut(Result<Vec<LeaderboardEntry>, SteamError>) + 'static + Send + where F: Fn(Result<Vec<LeaderboardEntry>, SteamError>) + 'static + Send { unsafe { let request = match request { |