11 releases (3 stable)
Uses new Rust 2024
| 3.0.0 | Oct 22, 2025 |
|---|---|
| 2.0.0 | Jun 8, 2025 |
| 1.0.0 | Oct 4, 2020 |
| 0.3.4 | Apr 15, 2020 |
| 0.3.1 | Nov 24, 2017 |
#608 in Parser implementations
735 downloads per month
Used in 9 crates
(7 directly)
22KB
482 lines
The steamid-ng crate provides an easy-to-use SteamID type with functions to parse and render
steam2 and steam3 IDs. It also supports serializing and deserializing via serde.
Examples
let x = SteamID::from_steam64(76561197960287930).unwrap();
let y = SteamID::from_steam3("[U:1:22202]").unwrap();
let z = SteamID::from_steam2("STEAM_1:0:11101").unwrap();
assert_eq!(x, y);
assert_eq!(y, z);
assert_eq!(u64::from(z), 76561197960287930);
assert_eq!(y.steam2(), "STEAM_1:0:11101");
assert_eq!(x.steam3(), "[U:1:22202]");
assert_eq!(x.account_id(), 22202);
assert_eq!(x.instance().instance_type(), Some(InstanceType::Desktop));
assert_eq!(x.account_type(), AccountType::Individual);
assert_eq!(x.universe(), Universe::Public);
// the SteamID type also has `set_{account_id, instance, account_type, universe}` methods,
// which work as you would expect.
All constructed SteamID types are valid Steam IDs; values provided will be validated in all cases. If an ID provided by an official Valve service fails to parse, that should be considered a bug in this library, and you should open an issue on GitHub.
steamid-ng

An easy-to-use SteamID type with functions to parse and render steam2 and steam3 IDs. This library is based off of SteamID.php by xPaw.
1.0 to 2.0 migration notes
The primary semantic breaking change between 1.0 (and earlier version) and 2.0 is that in 1.0, a constructed SteamID type is not necessarily valid, while in 2.0 it is always valid. This means that the library will explicitly validate your types while parsing, and functions on it will always return valid results.
Dependencies
~170KB