Skip to content

Commit

Permalink
uprev and tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jul 2, 2022
1 parent 9201d61 commit 8bd8048
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "speedate"
authors = ["Samuel Colvin <s@muelcolvin.com>"]
version = "0.4.1"
version = "0.5.0"
edition = "2021"
description = "Fast and simple datetime, date, time and duration parsing"
readme = "README.md"
Expand Down
18 changes: 8 additions & 10 deletions src/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,21 @@ impl PartialOrd for Duration {
/// ```
/// use speedate::Duration;
///
/// let d1 = Duration::parse_str("P3DT4H5M6.7S").unwrap();
/// let d2 = Duration::parse_str("P4DT1H").unwrap();
/// let duration = |s| Duration::parse_str(s).unwrap();
///
/// let d1 = duration("P3DT4H5M6.7S");
/// let d2 = duration("P4DT1H");
///
/// assert!(d2 > d1);
/// ```
///
/// `positive` is included in in comparisons, thus `+P1D` is greater than `-P2D`,
/// similarly `-P2D` is less than `-P1D`.
/// ```
/// use speedate::Duration;
///
/// fn d(s: &str) -> Duration {
/// Duration::parse_str(s).unwrap()
/// }
///
/// assert!(d("+P1D") > d("-P2D"));
/// assert!(d("-P2D") < d("-P1D"));
/// # use speedate::Duration;
/// # let duration = |s| Duration::parse_str(s).unwrap();
/// assert!(duration("+P1D") > duration("-P2D"));
/// assert!(duration("-P2D") < duration("-P1D"));
/// ```
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match (self.positive, other.positive) {
Expand Down

0 comments on commit 8bd8048

Please sign in to comment.