aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Collins <[email protected]>2018-02-27 19:06:58 +0000
committerMatthew Collins <[email protected]>2018-02-27 19:06:58 +0000
commita936e0be80405b7f85ef3fac3f0146651339ba89 (patch)
tree02f4f5ce4d5d333b1c36b05743055b89ff9fd22a /src
parentFix the metadata for the sys crate (diff)
downloadsteamworks-rs-a936e0be80405b7f85ef3fac3f0146651339ba89.tar.xz
steamworks-rs-a936e0be80405b7f85ef3fac3f0146651339ba89.zip
Add accessors for `SteamId`'s inner values
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bd311d3..01a5b24 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -281,6 +281,24 @@ impl Drop for ClientInner {
#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq)]
pub struct SteamId(pub(crate) u64);
+impl SteamId {
+ /// Creates a `SteamId` from a raw 64 bit value.
+ ///
+ /// May be useful for deserializing steam ids from
+ /// a network or save format.
+ pub fn from_raw(id: u64) -> SteamId {
+ SteamId(id)
+ }
+
+ /// Returns the raw 64 bit value of the steam id
+ ///
+ /// May be useful for serializing steam ids over a
+ /// network or to a save format.
+ pub fn raw(&self) -> u64 {
+ self.0
+ }
+}
+
pub unsafe trait Callback {
fn id() -> i32;
fn size() -> i32;