diff options
| author | Matthew Collins <[email protected]> | 2018-02-27 19:06:58 +0000 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2018-02-27 19:06:58 +0000 |
| commit | a936e0be80405b7f85ef3fac3f0146651339ba89 (patch) | |
| tree | 02f4f5ce4d5d333b1c36b05743055b89ff9fd22a /src/lib.rs | |
| parent | Fix the metadata for the sys crate (diff) | |
| download | steamworks-rs-a936e0be80405b7f85ef3fac3f0146651339ba89.tar.xz steamworks-rs-a936e0be80405b7f85ef3fac3f0146651339ba89.zip | |
Add accessors for `SteamId`'s inner values
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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; |