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:
Kang Seonghoon 2015-01-24 17:45:12 +09:00
parent 45765ebd13
commit cf5e2f322f
11 changed files with 35 additions and 35 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "chrono"
version = "0.1.14"
version = "0.1.15"
authors = ["Kang Seonghoon <public+rust@mearie.org>"]
description = "Date and time library for Rust"
@ -15,5 +15,5 @@ license = "MIT/Apache-2.0"
name = "chrono"
[dependencies]
time = "0.1.12"
time = "0.1.14"

View File

@ -1,4 +1,4 @@
[Chrono][doc] 0.1.13
[Chrono][doc] 0.1.15
====================
[![Chrono on Travis CI][travis-image]][travis]

View File

@ -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.
/// See the `format` module on the supported escape sequences.
#[inline]
@ -286,13 +286,13 @@ impl<Off:Offset> Sub<Duration> for Date<Off> {
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 {
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 {
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") }
}

View File

@ -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.
/// See the `format` module on the supported escape sequences.
#[inline]
@ -207,13 +207,13 @@ impl<Off:Offset> Sub<Duration> for DateTime<Off> {
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 {
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 {
write!(f, "{} {}", self.local(), self.offset)
}

View File

@ -201,13 +201,13 @@ impl<'a> DelayedFormat<'a> {
/// 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>,
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());
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 {
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...

View File

@ -4,7 +4,7 @@
/*!
# Chrono 0.1.14
# Chrono 0.1.15
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.

View File

@ -425,7 +425,7 @@ impl Sub<Duration> for NaiveDate {
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 {
let year = self.year();
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 {
let year = self.year();
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 {
let YearFlags(flags) = *self;
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 {
let Of(of) = *self;
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 {
let Mdf(mdf) = *self;
write!(f, "Mdf(({} << 9) | ({} << 4) | {:#04o} /*{:?}*/)",

View File

@ -205,13 +205,13 @@ impl Sub<Duration> for NaiveDateTime {
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 {
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 {
write!(f, "{} {}", self.date, self.time)
}

View File

@ -223,7 +223,7 @@ impl Sub<Duration> for NaiveTime {
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 {
let (hour, min, sec) = self.hms();
let (sec, nano) = if self.frac >= 1_000_000_000 {
@ -245,8 +245,8 @@ impl fmt::Show for NaiveTime {
}
}
impl fmt::String for NaiveTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Show::fmt(self, f) }
impl fmt::Display for NaiveTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self, f) }
}
#[cfg(test)]

View File

@ -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.
pub fn unwrap(self) -> T {
match self {
@ -137,7 +137,7 @@ impl<T: fmt::Show> LocalResult<T> {
}
/// 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.
/// 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() }
}
impl fmt::Show for UTC {
impl fmt::Debug for UTC {
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") }
}
@ -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 {
let offset = self.local_minus_utc;
let (sign, offset) = if offset < 0 {('-', -offset)} else {('+', offset)};
@ -448,8 +448,8 @@ impl fmt::Show for FixedOffset {
}
}
impl fmt::String for FixedOffset {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Show::fmt(self, f) }
impl fmt::Display for FixedOffset {
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.
@ -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) }
}
impl fmt::String for Local {
impl fmt::Display for Local {
// TODO this should be a tz name whenever available
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.cached.fmt(f) }
}

View File

@ -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.
/// See the `format` module on the supported escape sequences.
#[inline]
@ -135,13 +135,13 @@ impl<Off:Offset> Sub<Duration> for Time<Off> {
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 {
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 {
write!(f, "{}{}", self.local(), self.offset)
}