diff options
| author | Robin Stocker | 2017-08-22 05:29:28 +1000 |
|---|---|---|
| committer | Ed Barnard | 2017-08-21 20:29:28 +0100 |
| commit | 33f92308e8fe3f88a80b11eb7b2dee1d27977443 (patch) | |
| tree | 84251c18df98cefad6a2bb7c4b4d8aa10cbef78a | |
| parent | b0d6118889409aa6fb13a7855d5ede17c3d11cc1 (diff) | |
| download | rust-plist-33f92308e8fe3f88a80b11eb7b2dee1d27977443.tar.bz2 | |
Upgrade chrono from 0.3 to 0.4 (#23)
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/binary/reader.rs | 4 | ||||
| -rw-r--r-- | src/date.rs | 16 | ||||
| -rw-r--r-- | src/plist.rs | 4 | ||||
| -rw-r--r-- | src/xml/reader.rs | 4 | ||||
| -rw-r--r-- | src/xml/writer.rs | 4 | ||||
| -rw-r--r-- | tests/serde_tests/mod.rs | 4 |
7 files changed, 19 insertions, 19 deletions
@@ -15,7 +15,7 @@ default = ["serde"] [dependencies] base64 = "0.5.1" byteorder = "1.0.0" -chrono = "0.3.0" +chrono = "0.4.0" xml-rs = "0.4.1" serde = { version = "1.0.2", optional = true } diff --git a/src/binary/reader.rs b/src/binary/reader.rs index 25ead2a..f63f127 100644 --- a/src/binary/reader.rs +++ b/src/binary/reader.rs @@ -320,7 +320,7 @@ impl<R: Read + Seek> Iterator for EventReader<R> { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::fs::File; use std::path::Path; @@ -346,7 +346,7 @@ mod tests { StringValue("Height".to_owned()), RealValue(1.60), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), StringValue("Author".to_owned()), StringValue("William Shakespeare".to_owned()), StringValue("Data".to_owned()), diff --git a/src/date.rs b/src/date.rs index 55aa205..4091f28 100644 --- a/src/date.rs +++ b/src/date.rs @@ -1,4 +1,4 @@ -use chrono::{DateTime, Duration, TimeZone, UTC}; +use chrono::{DateTime, Duration, TimeZone, Utc}; use std::fmt; use std::str::FromStr; @@ -7,7 +7,7 @@ use {Error, Result}; /// A UTC timestamp. Used for serialization to and from the plist date type. #[derive(Clone, Debug, PartialEq)] pub struct Date { - inner: DateTime<UTC>, + inner: DateTime<Utc>, } impl Date { @@ -32,21 +32,21 @@ impl Date { let dur = Duration::milliseconds(whole_millis as i64); let dur = dur + Duration::nanoseconds(submilli_nanos as i64); - let plist_epoch = UTC.ymd(2001, 1, 1).and_hms(0, 0, 0); + let plist_epoch = Utc.ymd(2001, 1, 1).and_hms(0, 0, 0); let date = plist_epoch.checked_add_signed(dur).ok_or(Error::InvalidData)?; Ok(Date { inner: date }) } } -impl From<DateTime<UTC>> for Date { - fn from(date: DateTime<UTC>) -> Self { +impl From<DateTime<Utc>> for Date { + fn from(date: DateTime<Utc>) -> Self { Date { inner: date } } } -impl Into<DateTime<UTC>> for Date { - fn into(self) -> DateTime<UTC> { +impl Into<DateTime<Utc>> for Date { + fn into(self) -> DateTime<Utc> { self.inner } } @@ -62,7 +62,7 @@ impl FromStr for Date { fn from_str(s: &str) -> ::std::result::Result<Self, Self::Err> { let date = DateTime::parse_from_rfc3339(s).map_err(|_| ())?; - Ok(Date { inner: date.with_timezone(&UTC) }) + Ok(Date { inner: date.with_timezone(&Utc) }) } } diff --git a/src/plist.rs b/src/plist.rs index 7930754..27df833 100644 --- a/src/plist.rs +++ b/src/plist.rs @@ -339,7 +339,7 @@ mod tests { #[test] fn test_plist_access() { use std::collections::BTreeMap; - use chrono::*; + use chrono::prelude::*; use super::Date; let vec = vec![Plist::Real(0.0)]; @@ -360,7 +360,7 @@ mod tests { assert_eq!(Plist::Data(slice.to_vec()).into_data(), Some(slice.to_vec())); - let date: Date = UTC::now().into(); + let date: Date = Utc::now().into(); assert_eq!(Plist::Date(date.clone()).as_date(), Some(&date)); assert_eq!(Plist::Real(0.0).as_real(), Some(0.0)); diff --git a/src/xml/reader.rs b/src/xml/reader.rs index 465d264..e6b6953 100644 --- a/src/xml/reader.rs +++ b/src/xml/reader.rs @@ -146,7 +146,7 @@ impl<R: Read> Iterator for EventReader<R> { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::fs::File; use std::path::Path; @@ -176,7 +176,7 @@ mod tests { StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), StringValue("Blank".to_owned()), StringValue("".to_owned()), EndDictionary]; diff --git a/src/xml/writer.rs b/src/xml/writer.rs index 5d2e2f0..7048b32 100644 --- a/src/xml/writer.rs +++ b/src/xml/writer.rs @@ -187,7 +187,7 @@ impl<W: Write> PlistEventWriter for EventWriter<W> { #[cfg(test)] mod tests { - use chrono::{TimeZone, UTC}; + use chrono::{TimeZone, Utc}; use std::io::Cursor; use super::*; @@ -211,7 +211,7 @@ mod tests { StringValue("Data".to_owned()), DataValue(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]), StringValue("Birthdate".to_owned()), - DateValue(UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), + DateValue(Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into()), EndDictionary]; let mut cursor = Cursor::new(Vec::new()); diff --git a/tests/serde_tests/mod.rs b/tests/serde_tests/mod.rs index 3b1f76b..0793a98 100644 --- a/tests/serde_tests/mod.rs +++ b/tests/serde_tests/mod.rs @@ -1,4 +1,4 @@ -use chrono::{TimeZone, UTC}; +use chrono::{TimeZone, Utc}; use plist::{Date, EventWriter, PlistEvent, Result as PlistResult}; use plist::serde::{Serializer, Deserializer}; use plist::PlistEvent::*; @@ -247,7 +247,7 @@ struct TypeWithDate { #[test] fn type_with_date() { - let date: Date = UTC.ymd(1981, 05, 16).and_hms(11, 32, 06).into(); + let date: Date = Utc.ymd(1981, 05, 16).and_hms(11, 32, 06).into(); let obj = TypeWithDate { a: Some(28), |
