diff options
| author | Alex Parrill <[email protected]> | 2019-06-08 17:59:12 -0400 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2019-06-09 23:50:11 +0100 |
| commit | 0d34cc3689fb85a9963323751bd05e12af7f3b08 (patch) | |
| tree | 4686e6fea3c934aaf0232d046c1efb31b3769ff1 /src | |
| parent | Fix Query handle leaking on errors (diff) | |
| download | steamworks-rs-0d34cc3689fb85a9963323751bd05e12af7f3b08.tar.xz steamworks-rs-0d34cc3689fb85a9963323751bd05e12af7f3b08.zip | |
Add AccountId type
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 8 | ||||
| -rw-r--r-- | src/ugc.rs | 4 |
2 files changed, 8 insertions, 4 deletions
@@ -361,13 +361,17 @@ impl SteamId { } /// Returns the account id for this steam id - pub fn account_id(&self) -> u32 { + pub fn account_id(&self) -> AccountId { unsafe { - sys::steam_rust_get_account_id_from_steam_id(self.0).0 + AccountId(sys::steam_rust_get_account_id_from_steam_id(self.0).0) } } } +/// A user's account id +#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +pub struct AccountId(pub(crate) u32); + /// A game id /// /// Combines `AppId` and other information @@ -212,7 +212,7 @@ impl <Manager> UGC<Manager> { /// Queries a list of workshop itmes, related to a user in some way (Ex. user's subscriptions, favorites, upvoted, ...) pub fn query_user(&self, - account: u32, + account: AccountId, list_type: UserList, item_type: UGCType, sort_order: UserListOrder, @@ -222,7 +222,7 @@ impl <Manager> UGC<Manager> { unsafe { let res = sys::SteamAPI_ISteamUGC_CreateQueryUserUGCRequest( self.ugc, - sys::AccountID_t(account), + sys::AccountID_t(account.0), list_type.into(), item_type.into(), sort_order.into(), |