diff options
| author | Flaise <[email protected]> | 2019-08-02 20:30:48 -0500 |
|---|---|---|
| committer | Matthew Collins <[email protected]> | 2019-08-03 09:08:03 +0100 |
| commit | f109df710c3715b1bf863c5b3f1ac1f8a53b39ed (patch) | |
| tree | 6927c655417ede7c48e168892bf3cae32512cc80 /src/lib.rs | |
| parent | Implemented Serialize, Deserialize and other common traits where appropriate (diff) | |
| download | steamworks-rs-f109df710c3715b1bf863c5b3f1ac1f8a53b39ed.tar.xz steamworks-rs-f109df710c3715b1bf863c5b3f1ac1f8a53b39ed.zip | |
Made serde dependency optional
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -41,6 +41,8 @@ use std::fmt::{ }; use std::marker::PhantomData; use std::collections::HashMap; + +#[cfg(feature = "serde")] use serde::{Serialize, Deserialize}; pub type SResult<T> = Result<T, SteamError>; @@ -334,7 +336,8 @@ impl Drop for ClientManager { } /// A user's steam id -#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct SteamId(pub(crate) u64); impl SteamId { @@ -370,13 +373,15 @@ impl SteamId { } /// A user's account id -#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct AccountId(pub(crate) u32); /// A game id /// /// Combines `AppId` and other information -#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, Ord, PartialOrd, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct GameId(pub(crate) u64); impl GameId { |