Skip to content

Commit

Permalink
Revert "Merge pull request #7 from olliemath/0-3-release-branch"
Browse files Browse the repository at this point in the history
This reverts commit 6f7d9a2, reversing
changes made to c58bdd8.
  • Loading branch information
olliemath committed Sep 29, 2023
1 parent 2d84ac0 commit 78fc065
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 332 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
Expand All @@ -74,4 +74,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
args: -- -D warnings -A deprecated
26 changes: 0 additions & 26 deletions .github/workflows/publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
name = "chronoutil"
readme = "README.md"
repository = "https://github.com/olliemath/chronoutil"
version = "0.3.0"
version = "0.2.5"

[dependencies]
"chrono" = { version = "^0.4.24", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2023 Oliver Margetts
Copyright (c) 2020-2022 Oliver Margetts

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ Put this in your `Cargo.toml`:

```toml
[dependencies]
chronoutil = "0.3"
chronoutil = "0.2.5"
```

## Overview

### RelativeDuration

ChronoUtils uses a [**`RelativeDuration`**](https://docs.rs/chronoutil/0.3.0/chronoutil/relative_duration/struct.RelativeDuration.html) type to represent the magnitude of a time span
ChronoUtils uses a [**`RelativeDuration`**](https://docs.rs/chronoutil/0.2.5/chronoutil/relative_duration/struct.RelativeDuration.html) type to represent the magnitude of a time span
which may not be absolute (i.e. which is not simply a fixed number of nanoseconds).
A relative duration is made up of a number of months together with an absolute [`Duration`]()
component.
Expand All @@ -61,7 +61,7 @@ assert_eq!(start + delta, NaiveDate::from_ymd(2020, 3, 1));
### DateRule

ChronoUtil provides a
[**`DateRule`**](https://docs.rs/chronoutil/0.3.0/chronoutil/rule/struct.DateRule.html)
[**`DateRule`**](https://docs.rs/chronoutil/0.2.5/chronoutil/rule/struct.DateRule.html)
iterator to reliably generate a collection of dates at regular intervals.
For example, the following will yield one `NaiveDate` on the last day of each
month in 2025:
Expand All @@ -76,11 +76,11 @@ let rule = DateRule::monthly(start).with_count(12);

ChronoUtil also exposes useful shift functions which are used internally, namely:

- [**`shift_months`**](https://docs.rs/chronoutil/0.3.0/chronoutil/delta/fn.shift_months.html) to shift a datelike value by a given number of months
- [**`shift_years`**](https://docs.rs/chronoutil/0.3.0/chronoutil/delta/fn.shift_years.html) to shift a datelike value by a given number of years
- [**`with_year`**](https://docs.rs/chronoutil/0.3.0/chronoutil/delta/fn.shift_months.html) to shift a datelike value to a given day
- [**`with_month`**](https://docs.rs/chronoutil/0.3.0/chronoutil/delta/fn.with_month.html) to shift a datelike value to a given month
- [**`with_year`**](https://docs.rs/chronoutil/0.3.0/chronoutil/delta/fn.with_year.html) to shift a datelike value to a given year
- [**`shift_months`**](https://docs.rs/chronoutil/0.2.5/chronoutil/delta/fn.shift_months.html) to shift a datelike value by a given number of months
- [**`shift_years`**](https://docs.rs/chronoutil/0.2.5/chronoutil/delta/fn.shift_years.html) to shift a datelike value by a given number of years
- [**`with_year`**](https://docs.rs/chronoutil/0.2.5/chronoutil/delta/fn.shift_months.html) to shift a datelike value to a given day
- [**`with_month`**](https://docs.rs/chronoutil/0.2.5/chronoutil/delta/fn.with_month.html) to shift a datelike value to a given month
- [**`with_year`**](https://docs.rs/chronoutil/0.2.5/chronoutil/delta/fn.with_year.html) to shift a datelike value to a given year

## Design decisions and gotchas

Expand Down
4 changes: 2 additions & 2 deletions benches/delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use chronoutil::delta::{is_leap_year, shift_months};

fn shift_months_benchmark(c: &mut Criterion) {
let shifts = black_box(-18..19);
let base = NaiveDate::from_ymd_opt(2020, 12, 31).unwrap();
let base = NaiveDate::from_ymd(2020, 12, 31);

c.bench_function("shift_months", |b| {
b.iter::<Vec<NaiveDate>, _>(|| shifts.clone().map(|s| shift_months(base, s)).collect())
Expand All @@ -29,7 +29,7 @@ fn shift_months_many_benchmark(c: &mut Criterion) {
for m in 1..13 {
for d in 1..31 {
if in_month(y, m, d) {
bases.push(NaiveDate::from_ymd_opt(y, m, d).unwrap());
bases.push(NaiveDate::from_ymd(y, m, d));
}
}
}
Expand Down
Loading

0 comments on commit 78fc065

Please sign in to comment.