0.1.15: language changes.
- `std::fmt::Show` is now `std::fmt::Debug`. - `std::fmt::String` is now `std::fmt::Display`.
This commit is contained in:
parent
45765ebd13
commit
cf5e2f322f
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.1.14"
|
version = "0.1.15"
|
||||||
authors = ["Kang Seonghoon <public+rust@mearie.org>"]
|
authors = ["Kang Seonghoon <public+rust@mearie.org>"]
|
||||||
|
|
||||||
description = "Date and time library for Rust"
|
description = "Date and time library for Rust"
|
||||||
|
@ -15,5 +15,5 @@ license = "MIT/Apache-2.0"
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
time = "0.1.12"
|
time = "0.1.14"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[Chrono][doc] 0.1.13
|
[Chrono][doc] 0.1.15
|
||||||
====================
|
====================
|
||||||
|
|
||||||
[![Chrono on Travis CI][travis-image]][travis]
|
[![Chrono on Travis CI][travis-image]][travis]
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl<Off:Offset> Date<Off> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> Date<Off> {
|
impl<Off: Offset + fmt::Display> Date<Off> {
|
||||||
/// Formats the date in the specified format string.
|
/// Formats the date in the specified format string.
|
||||||
/// See the `format` module on the supported escape sequences.
|
/// See the `format` module on the supported escape sequences.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -286,13 +286,13 @@ impl<Off:Offset> Sub<Duration> for Date<Off> {
|
||||||
fn sub(self, rhs: Duration) -> Date<Off> { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> Date<Off> { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset> fmt::Show for Date<Off> {
|
impl<Off: Offset> fmt::Debug for Date<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}{:?}", self.local(), self.offset)
|
write!(f, "{:?}{:?}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> fmt::String for Date<Off> {
|
impl<Off: Offset + fmt::Display> fmt::Display for Date<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{}{}", self.local(), self.offset)
|
write!(f, "{}{}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
|
@ -334,7 +334,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for UTC1y {
|
impl fmt::Debug for UTC1y {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "+8760:00") }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "+8760:00") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl<Off:Offset> DateTime<Off> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> DateTime<Off> {
|
impl<Off: Offset + fmt::Display> DateTime<Off> {
|
||||||
/// Formats the combined date and time in the specified format string.
|
/// Formats the combined date and time in the specified format string.
|
||||||
/// See the `format` module on the supported escape sequences.
|
/// See the `format` module on the supported escape sequences.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -207,13 +207,13 @@ impl<Off:Offset> Sub<Duration> for DateTime<Off> {
|
||||||
fn sub(self, rhs: Duration) -> DateTime<Off> { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> DateTime<Off> { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset> fmt::Show for DateTime<Off> {
|
impl<Off: Offset> fmt::Debug for DateTime<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}{:?}", self.local(), self.offset)
|
write!(f, "{:?}{:?}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> fmt::String for DateTime<Off> {
|
impl<Off: Offset + fmt::Display> fmt::Display for DateTime<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{} {}", self.local(), self.offset)
|
write!(f, "{} {}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,13 +201,13 @@ impl<'a> DelayedFormat<'a> {
|
||||||
/// Makes a new `DelayedFormat` value out of local date and time and UTC offset.
|
/// Makes a new `DelayedFormat` value out of local date and time and UTC offset.
|
||||||
pub fn new_with_offset<Off>(date: Option<NaiveDate>, time: Option<NaiveTime>,
|
pub fn new_with_offset<Off>(date: Option<NaiveDate>, time: Option<NaiveTime>,
|
||||||
offset: &Off, fmt: &'a str) -> DelayedFormat<'a>
|
offset: &Off, fmt: &'a str) -> DelayedFormat<'a>
|
||||||
where Off: Offset + fmt::String {
|
where Off: Offset + fmt::Display {
|
||||||
let name_and_diff = (offset.to_string(), offset.local_minus_utc());
|
let name_and_diff = (offset.to_string(), offset.local_minus_utc());
|
||||||
DelayedFormat { date: date, time: time, off: Some(name_and_diff), fmt: fmt }
|
DelayedFormat { date: date, time: time, off: Some(name_and_diff), fmt: fmt }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> fmt::String for DelayedFormat<'a> {
|
impl<'a> fmt::Display for DelayedFormat<'a> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let ret = format(f, self.date.as_ref(), self.time.as_ref(), self.off.as_ref(), self.fmt);
|
let ret = format(f, self.date.as_ref(), self.time.as_ref(), self.off.as_ref(), self.fmt);
|
||||||
ret.map_err(|_| fmt::Error) // we don't have any good means to pass detailed errors...
|
ret.map_err(|_| fmt::Error) // we don't have any good means to pass detailed errors...
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
# Chrono 0.1.14
|
# Chrono 0.1.15
|
||||||
|
|
||||||
Date and time handling for Rust. (also known as `rust-chrono`)
|
Date and time handling for Rust. (also known as `rust-chrono`)
|
||||||
It aims to be a feature-complete superset of the [time](https://github.com/rust-lang/time) library.
|
It aims to be a feature-complete superset of the [time](https://github.com/rust-lang/time) library.
|
||||||
|
|
|
@ -425,7 +425,7 @@ impl Sub<Duration> for NaiveDate {
|
||||||
fn sub(self, rhs: Duration) -> NaiveDate { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> NaiveDate { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for NaiveDate {
|
impl fmt::Debug for NaiveDate {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let year = self.year();
|
let year = self.year();
|
||||||
let mdf = self.mdf();
|
let mdf = self.mdf();
|
||||||
|
@ -438,7 +438,7 @@ impl fmt::Show for NaiveDate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for NaiveDate {
|
impl fmt::Display for NaiveDate {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let year = self.year();
|
let year = self.year();
|
||||||
let mdf = self.mdf();
|
let mdf = self.mdf();
|
||||||
|
@ -930,7 +930,7 @@ mod internals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for YearFlags {
|
impl fmt::Debug for YearFlags {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let YearFlags(flags) = *self;
|
let YearFlags(flags) = *self;
|
||||||
match flags {
|
match flags {
|
||||||
|
@ -1152,7 +1152,7 @@ mod internals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for Of {
|
impl fmt::Debug for Of {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let Of(of) = *self;
|
let Of(of) = *self;
|
||||||
write!(f, "Of(({} << 4) | {:#04o} /*{:?}*/)",
|
write!(f, "Of(({} << 4) | {:#04o} /*{:?}*/)",
|
||||||
|
@ -1249,7 +1249,7 @@ mod internals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for Mdf {
|
impl fmt::Debug for Mdf {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let Mdf(mdf) = *self;
|
let Mdf(mdf) = *self;
|
||||||
write!(f, "Mdf(({} << 9) | ({} << 4) | {:#04o} /*{:?}*/)",
|
write!(f, "Mdf(({} << 9) | ({} << 4) | {:#04o} /*{:?}*/)",
|
||||||
|
|
|
@ -205,13 +205,13 @@ impl Sub<Duration> for NaiveDateTime {
|
||||||
fn sub(self, rhs: Duration) -> NaiveDateTime { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> NaiveDateTime { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for NaiveDateTime {
|
impl fmt::Debug for NaiveDateTime {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}T{:?}", self.date, self.time)
|
write!(f, "{:?}T{:?}", self.date, self.time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for NaiveDateTime {
|
impl fmt::Display for NaiveDateTime {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{} {}", self.date, self.time)
|
write!(f, "{} {}", self.date, self.time)
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ impl Sub<Duration> for NaiveTime {
|
||||||
fn sub(self, rhs: Duration) -> NaiveTime { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> NaiveTime { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for NaiveTime {
|
impl fmt::Debug for NaiveTime {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let (hour, min, sec) = self.hms();
|
let (hour, min, sec) = self.hms();
|
||||||
let (sec, nano) = if self.frac >= 1_000_000_000 {
|
let (sec, nano) = if self.frac >= 1_000_000_000 {
|
||||||
|
@ -245,8 +245,8 @@ impl fmt::Show for NaiveTime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for NaiveTime {
|
impl fmt::Display for NaiveTime {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Show::fmt(self, f) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self, f) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl<Off:Offset> LocalResult<Date<Off>> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: fmt::Show> LocalResult<T> {
|
impl<T: fmt::Debug> LocalResult<T> {
|
||||||
/// Returns the single unique conversion result, or fails accordingly.
|
/// Returns the single unique conversion result, or fails accordingly.
|
||||||
pub fn unwrap(self) -> T {
|
pub fn unwrap(self) -> T {
|
||||||
match self {
|
match self {
|
||||||
|
@ -137,7 +137,7 @@ impl<T: fmt::Show> LocalResult<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The offset from the local time to UTC.
|
/// The offset from the local time to UTC.
|
||||||
pub trait Offset: Clone + fmt::Show {
|
pub trait Offset: Clone + fmt::Debug {
|
||||||
/// Makes a new `Date` from year, month, day and the current offset.
|
/// Makes a new `Date` from year, month, day and the current offset.
|
||||||
/// This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.
|
/// This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.
|
||||||
///
|
///
|
||||||
|
@ -350,11 +350,11 @@ impl Offset for UTC {
|
||||||
fn to_local_datetime(&self, utc: &NaiveDateTime) -> NaiveDateTime { utc.clone() }
|
fn to_local_datetime(&self, utc: &NaiveDateTime) -> NaiveDateTime { utc.clone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for UTC {
|
impl fmt::Debug for UTC {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Z") }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Z") }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for UTC {
|
impl fmt::Display for UTC {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "UTC") }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "UTC") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ impl Offset for FixedOffset {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for FixedOffset {
|
impl fmt::Debug for FixedOffset {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let offset = self.local_minus_utc;
|
let offset = self.local_minus_utc;
|
||||||
let (sign, offset) = if offset < 0 {('-', -offset)} else {('+', offset)};
|
let (sign, offset) = if offset < 0 {('-', -offset)} else {('+', offset)};
|
||||||
|
@ -448,8 +448,8 @@ impl fmt::Show for FixedOffset {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for FixedOffset {
|
impl fmt::Display for FixedOffset {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Show::fmt(self, f) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self, f) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The local timescale. This is implemented via the standard `time` crate.
|
/// The local timescale. This is implemented via the standard `time` crate.
|
||||||
|
@ -537,11 +537,11 @@ impl Offset for Local {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Show for Local {
|
impl fmt::Debug for Local {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.cached.fmt(f) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.cached.fmt(f) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::String for Local {
|
impl fmt::Display for Local {
|
||||||
// TODO this should be a tz name whenever available
|
// TODO this should be a tz name whenever available
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.cached.fmt(f) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.cached.fmt(f) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl<Off:Offset> Time<Off> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> Time<Off> {
|
impl<Off: Offset + fmt::Display> Time<Off> {
|
||||||
/// Formats the time in the specified format string.
|
/// Formats the time in the specified format string.
|
||||||
/// See the `format` module on the supported escape sequences.
|
/// See the `format` module on the supported escape sequences.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -135,13 +135,13 @@ impl<Off:Offset> Sub<Duration> for Time<Off> {
|
||||||
fn sub(self, rhs: Duration) -> Time<Off> { self.add(-rhs) }
|
fn sub(self, rhs: Duration) -> Time<Off> { self.add(-rhs) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset> fmt::Show for Time<Off> {
|
impl<Off: Offset> fmt::Debug for Time<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{:?}{:?}", self.local(), self.offset)
|
write!(f, "{:?}{:?}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Off: Offset + fmt::String> fmt::String for Time<Off> {
|
impl<Off: Offset + fmt::Display> fmt::Display for Time<Off> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
write!(f, "{}{}", self.local(), self.offset)
|
write!(f, "{}{}", self.local(), self.offset)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue