Skip to content

Commit acf4eab

Browse files
committed
more documentation, finishing examples for chrono::naive::date.
1 parent 37c7f78 commit acf4eab

7 files changed

Lines changed: 261 additions & 57 deletions

File tree

src/date.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ impl<Tz: TimeZone> Date<Tz> where Tz::Offset: fmt::Display {
231231
}
232232

233233
/// Formats the date with the specified format string.
234-
/// See the `format::strftime` module on the supported escape sequences.
234+
/// See the [`format::strftime` module](../format/strftime/index.html)
235+
/// on the supported escape sequences.
235236
#[inline]
236237
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
237238
self.format_with_items(StrftimeItems::new(fmt))

src/datetime.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ impl DateTime<FixedOffset> {
146146

147147
/// Parses a string with the specified format string and
148148
/// returns a new `DateTime` with a parsed `FixedOffset`.
149-
/// See the `format::strftime` module on the supported escape sequences.
149+
/// See the [`format::strftime` module](../format/strftime/index.html)
150+
/// on the supported escape sequences.
150151
///
151152
/// See also `Offset::datetime_from_str` which gives a local `DateTime` on specific time zone.
152153
pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<DateTime<FixedOffset>> {
@@ -178,7 +179,8 @@ impl<Tz: TimeZone> DateTime<Tz> where Tz::Offset: fmt::Display {
178179
}
179180

180181
/// Formats the combined date and time with the specified format string.
181-
/// See the `format::strftime` module on the supported escape sequences.
182+
/// See the [`format::strftime` module](../format/strftime/index.html)
183+
/// on the supported escape sequences.
182184
#[inline]
183185
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
184186
self.format_with_items(StrftimeItems::new(fmt))

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ impl Weekday {
424424
}
425425
}
426426

427+
/// Any weekday can be represented as an integer from 0 to 6,
428+
/// which equals to `Weekday::num_days_from_monday` in this implementation.
429+
/// Do not heavily depend on this though; use explicit methods whenever possible.
427430
impl num::traits::FromPrimitive for Weekday {
428431

429432
#[inline]

src/naive/date.rs

Lines changed: 242 additions & 49 deletions
Large diffs are not rendered by default.

src/naive/datetime.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ impl NaiveDateTime {
7575
}
7676

7777
/// Parses a string with the specified format string and returns a new `NaiveDateTime`.
78-
/// See the `format::strftime` module on the supported escape sequences.
78+
/// See the [`format::strftime` module](../../format/strftime/index.html)
79+
/// on the supported escape sequences.
7980
pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveDateTime> {
8081
let mut parsed = Parsed::new();
8182
try!(parse(&mut parsed, s, StrftimeItems::new(fmt)));
@@ -162,7 +163,8 @@ impl NaiveDateTime {
162163
}
163164

164165
/// Formats the combined date and time with the specified format string.
165-
/// See the `format::strftime` module on the supported escape sequences.
166+
/// See the [`format::strftime` module](../../format/strftime/index.html)
167+
/// on the supported escape sequences.
166168
#[inline]
167169
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
168170
self.format_with_items(StrftimeItems::new(fmt))

src/naive/time.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ impl NaiveTime {
119119
}
120120

121121
/// Parses a string with the specified format string and returns a new `NaiveTime`.
122-
/// See the `format::strftime` module on the supported escape sequences.
122+
/// See the [`format::strftime` module](../../format/strftime/index.html)
123+
/// on the supported escape sequences.
123124
pub fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveTime> {
124125
let mut parsed = Parsed::new();
125126
try!(parse(&mut parsed, s, StrftimeItems::new(fmt)));
@@ -134,7 +135,8 @@ impl NaiveTime {
134135
}
135136

136137
/// Formats the time with the specified format string.
137-
/// See the `format::strftime` module on the supported escape sequences.
138+
/// See the [`format::strftime` module](../../format/strftime/index.html)
139+
/// on the supported escape sequences.
138140
#[inline]
139141
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>> {
140142
self.format_with_items(StrftimeItems::new(fmt))

src/offset/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ pub trait TimeZone: Sized + Clone {
272272

273273
/// Parses a string with the specified format string and
274274
/// returns a `DateTime` with the current offset.
275-
/// See the `format::strftime` module on the supported escape sequences.
275+
/// See the [`format::strftime` module](../../format/strftime/index.html)
276+
/// on the supported escape sequences.
276277
///
277278
/// If the format does not include offsets, the current offset is assumed;
278279
/// otherwise the input should have a matching UTC offset.

0 commit comments

Comments
 (0)