Replace dependency "chrono" with "time"

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2022-12-29 16:18:16 +01:00 committed by Scott Boggs
parent 96fbef900e
commit 5832111f46
4 changed files with 12 additions and 9 deletions

View File

@ -36,9 +36,9 @@ features = ["v4"]
version = "0.4"
features = ["kv_unstable", "serde", "std", "kv_unstable_serde", "kv_unstable_std"]
[dependencies.chrono]
version = "0.4"
features = ["serde"]
[dependencies.time]
version = "0.3"
features = ["parsing", "serde", "formatting"]
[dependencies.envy]
version = "0.4"

View File

@ -1,12 +1,12 @@
//! A module containing everything relating to a account returned from the api.
use crate::status_builder;
use chrono::prelude::*;
use serde::{
de::{self, Deserializer, Unexpected},
Deserialize, Serialize,
};
use std::path::PathBuf;
use time::{serde::iso8601, OffsetDateTime};
/// A struct representing an Account.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@ -18,7 +18,8 @@ pub struct Account {
/// URL to the avatar static image (gif)
pub avatar_static: String,
/// The time the account was created.
pub created_at: DateTime<Utc>,
#[serde(with = "iso8601")]
pub created_at: OffsetDateTime,
/// The account's display name.
pub display_name: String,
/// The number of followers for the account.

View File

@ -1,8 +1,8 @@
//! Module containing all info about notifications.
use super::{account::Account, status::Status};
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
use time::{serde::iso8601, OffsetDateTime};
/// A struct containing info about a notification.
#[allow(clippy::derive_partial_eq_without_eq)]
@ -14,7 +14,8 @@ pub struct Notification {
#[serde(rename = "type")]
pub notification_type: NotificationType,
/// The time the notification was created.
pub created_at: DateTime<Utc>,
#[serde(with = "iso8601")]
pub created_at: OffsetDateTime,
/// The Account sending the notification to the user.
pub account: Account,
/// The Status associated with the notification, if applicable.

View File

@ -2,8 +2,8 @@
use super::prelude::*;
use crate::{entities::card::Card, status_builder::Visibility};
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
use time::{serde::iso8601, OffsetDateTime};
/// A status from the instance.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
@ -28,7 +28,8 @@ pub struct Status {
/// (remote HTML already sanitized)
pub content: String,
/// The time the status was created.
pub created_at: DateTime<Utc>,
#[serde(with = "iso8601")]
pub created_at: OffsetDateTime,
/// An array of Emoji
pub emojis: Vec<Emoji>,
/// The numbef or replies to this status.