aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Parrill <[email protected]>2019-06-08 17:59:12 -0400
committerMatthew Collins <[email protected]>2019-06-09 23:50:11 +0100
commit0d34cc3689fb85a9963323751bd05e12af7f3b08 (patch)
tree4686e6fea3c934aaf0232d046c1efb31b3769ff1 /src
parentFix Query handle leaking on errors (diff)
downloadsteamworks-rs-0d34cc3689fb85a9963323751bd05e12af7f3b08.tar.xz
steamworks-rs-0d34cc3689fb85a9963323751bd05e12af7f3b08.zip
Add AccountId type
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs8
-rw-r--r--src/ugc.rs4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3a079b8..442e865 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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
diff --git a/src/ugc.rs b/src/ugc.rs
index a3ff38b..672507e 100644
--- a/src/ugc.rs
+++ b/src/ugc.rs
@@ -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(),