twilight_model/gateway/payload/incoming/
presence_update.rs1use crate::gateway::presence::Presence;
2use serde::{Deserialize, Serialize};
3use std::ops::{Deref, DerefMut};
4
5#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
17pub struct PresenceUpdate(pub Presence);
18
19impl Deref for PresenceUpdate {
20 type Target = Presence;
21
22 fn deref(&self) -> &Self::Target {
23 &self.0
24 }
25}
26
27impl DerefMut for PresenceUpdate {
28 fn deref_mut(&mut self) -> &mut Self::Target {
29 &mut self.0
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::PresenceUpdate;
36 use serde::{Deserialize, Serialize};
37 use static_assertions::assert_impl_all;
38 use std::{
39 fmt::Debug,
40 hash::Hash,
41 ops::{Deref, DerefMut},
42 };
43
44 assert_impl_all!(
45 PresenceUpdate: Clone,
46 Debug,
47 Deref,
48 DerefMut,
49 Deserialize<'static>,
50 Eq,
51 Hash,
52 PartialEq,
53 Serialize,
54 Send,
55 Sync
56 );
57}