aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorFlaise <[email protected]>2019-08-02 20:30:48 -0500
committerMatthew Collins <[email protected]>2019-08-03 09:08:03 +0100
commitf109df710c3715b1bf863c5b3f1ac1f8a53b39ed (patch)
tree6927c655417ede7c48e168892bf3cae32512cc80 /src/lib.rs
parentImplemented Serialize, Deserialize and other common traits where appropriate (diff)
downloadsteamworks-rs-f109df710c3715b1bf863c5b3f1ac1f8a53b39ed.tar.xz
steamworks-rs-f109df710c3715b1bf863c5b3f1ac1f8a53b39ed.zip
Made serde dependency optional
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6f85d0f..a041ac6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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 {