Skip to content

Add recipes for date-time using std. Fixes #787. - #836

Merged
AndyGauge merged 1 commit into
rust-lang-nursery:masterfrom
rndomd:issue-787
Aug 23, 2026
Merged

Add recipes for date-time using std. Fixes #787.#836
AndyGauge merged 1 commit into
rust-lang-nursery:masterfrom
rndomd:issue-787

Conversation

@rndomd

@rndomd rndomd commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

fixes #787

  • the tests are passing locally with cargo xtask test all
  • commits are squashed into one and rebased to latest master
  • PR contains correct "fixes #ISSUE_ID" clause to autoclose the issue on PR merge
    • if issue does not exist consider creating it or remove the clause
  • non rendered items are in sorted order (links, reference, identifiers, Cargo.toml)
  • links to docs.rs have wildcard version https://docs.rs/tar/*/tar/struct.Entry.html
  • example has standard error handling
  • code identifiers in description are in hyperlinked backticks
[`Entry::unpack`]: https://docs.rs/tar/*/tar/struct.Entry.html#method.unpack
  • check if CI is happy with your PR

@AndyGauge AndyGauge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

benchmark example actually is just discarded by LLVM so its super ineffective at showing usefulness

Comment thread src/datetime/duration/benchmark.md

@AndyGauge AndyGauge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the three snippets are rustfmt-formatted.

 awk '/^```rust/{flag=1;next}/^```$/{flag=0}flag'
  src/datetime/duration/benchmark.md > /tmp/snippet.rs
  rustfmt --edition 2021 /tmp/snippet.rs
  cat /tmp/snippet.rs   # paste this back into the ```rust block

Repeat with convert_to_unix.md. or run cargo fmt on each snippet after pasting itinto a scratch .rs file locally

simplify to Duration::from_secs(1) directly as the math here isn't really highly re-usable.

Comment thread src/datetime/duration/convert_to_unix.md Outdated
@AndyGauge

Copy link
Copy Markdown
Contributor

@randomctl I'm happy to make those suggestions, let me know if you need help getting rustfmt.

@AndyGauge AndyGauge mentioned this pull request Aug 22, 2026
@rndomd

rndomd commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

@randomctl I'm happy to make those suggestions, let me know if you need help getting rustfmt.

Done! I thought I had run the rustfmt, maybe I lost it when doing additional changes. Sorry! I think now they are well formatted!

@AndyGauge AndyGauge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Thank you!

@AndyGauge
AndyGauge merged commit 1837612 into rust-lang-nursery:master Aug 23, 2026
4 checks passed
@AndyGauge

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add std::time section with Instant, Duration, and SystemTime

2 participants