Skip to content

Commit

Permalink
min/max examples in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bragov4ik committed Jul 22, 2024
1 parent 4c56937 commit ec07b3d
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/naive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ impl NaiveWeek {
/// ```
/// use chrono::{NaiveDate, Weekday};
///
/// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap();
/// let date = NaiveDate::MIN;
/// let week = date.week(Weekday::Mon);
/// assert!(week.checked_first_day().unwrap() <= date);
/// let Some(first_day) = week.checked_first_day() else {
/// // error handling code
/// return;
/// };
/// assert!(first_day == date);
/// ```

Check warning on line 83 in src/naive/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/naive/mod.rs#L83

Added line #L83 was not covered by tests
#[inline]
#[must_use]
Expand Down Expand Up @@ -120,9 +124,13 @@ impl NaiveWeek {
/// ```
/// use chrono::{NaiveDate, Weekday};
///
/// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap();
/// let date = NaiveDate::MAX;
/// let week = date.week(Weekday::Mon);
/// assert!(week.checked_last_day().unwrap() >= date);
/// let Some(last_day) = week.checked_last_day() else {
/// // error handling code
/// return;
/// };
/// assert!(last_day == date);
/// ```

Check warning on line 134 in src/naive/mod.rs

View check run for this annotation

Codecov / codecov/patch

src/naive/mod.rs#L134

Added line #L134 was not covered by tests
#[inline]
#[must_use]
Expand Down Expand Up @@ -170,14 +178,15 @@ impl NaiveWeek {
///
/// # Examples
///
/// todo: examples with min/max
/// ```
/// use chrono::{NaiveDate, Weekday};
///
/// let date = NaiveDate::from_ymd_opt(2022, 4, 18).unwrap();
/// let date = NaiveDate::MAX;
/// let week = date.week(Weekday::Mon);
/// let days = week.checked_days().unwrap();
/// assert!(days.contains(&date));
/// let Some(_days) = week.checked_days() else {
/// // error handling code
/// return;
/// };
/// ```
#[inline]
#[must_use]
Expand Down

0 comments on commit ec07b3d

Please sign in to comment.