From 990e611a56f37f64fbce74fbc487c7dcc4aa4e28 Mon Sep 17 00:00:00 2001 From: Zeyla Hellyer Date: Sun, 4 Jun 2017 20:32:25 -0700 Subject: Use chrono for struct timestamp fields Chrono is easier to use than timestamped strings, so they should be automatically deserialized and available for the user, instead of having the user deserialize the strings themselves. These fields have been changed to use a type of `DateTime`: - `ChannelPinsUpdateEvent.last_pin_timestamp` - `Group.last_pin_timestamp` - `Guild.joined_at` - `GuildChannel.last_pin_timestamp` - `Invite.created_at` - `Member.joined_at` - `Message.edited_timestamp - `Message.timestamp` - `MessageUpdateEvent.edited_timestamp` - `MessageUpdateEvent.timestamp` - `PrivateChannel.last_pin_timestamp` `Member.joined_at` is now also an `Option`. Previously, if a Guild Member Update was received for a member not in the cache, a new Member would be instantiated with a default String value. This is incorrect behaviour, and has now been replaced with being set to `None` in that case. Id methods' `created_at()` method now return a `chrono::NaiveDateTime` instead of a `time::Timespec`, and `User::created_at` has been updated to reflect that. Additionally, drop `time` as a direct dependency and use chrono for internals. --- src/cache/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cache') diff --git a/src/cache/mod.rs b/src/cache/mod.rs index 246ca02..98c6648 100644 --- a/src/cache/mod.rs +++ b/src/cache/mod.rs @@ -960,7 +960,7 @@ impl Cache { guild.members.insert(event.user.id, Member { deaf: false, guild_id: Some(event.guild_id), - joined_at: String::default(), + joined_at: None, mute: false, nick: event.nick.clone(), roles: event.roles.clone(), -- cgit v1.2.3