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/friends.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/friends.rs')
| -rw-r--r-- | src/friends.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/friends.rs b/src/friends.rs index 770b542..b7a12f0 100644 --- a/src/friends.rs +++ b/src/friends.rs @@ -5,7 +5,7 @@ use std::net::Ipv4Addr; const CALLBACK_BASE_ID: i32 = 300; bitflags! { - #[derive(Serialize, Deserialize)] + #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[repr(C)] pub struct FriendFlags: u16 { const NONE = 0x0000; @@ -27,7 +27,7 @@ bitflags! { } bitflags! { - #[derive(Serialize, Deserialize)] + #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[repr(C)] pub struct PersonaChange: i32 { const NAME = 0x0001; @@ -115,7 +115,8 @@ impl <Manager> Friends<Manager> { } /// Information about a friend's current state in a game -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct FriendGame { /// The id of the game that the friend is /// playing @@ -130,7 +131,8 @@ pub struct FriendGame { pub lobby: LobbyId, } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct PersonaStateChange { pub steam_id: SteamId, pub flags: PersonaChange, @@ -149,7 +151,8 @@ unsafe impl Callback for PersonaStateChange { } } -#[derive(Clone, Debug, Serialize, Deserialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct GameLobbyJoinRequested { pub lobby_steam_id: LobbyId, pub friend_steam_id: SteamId, |