Skip to content

feat(duration): support std duration#87

Open
puneetdixit200 wants to merge 1 commit into
rust-postgres-interval:masterfrom
puneetdixit200:feat/std-duration
Open

feat(duration): support std duration#87
puneetdixit200 wants to merge 1 commit into
rust-postgres-interval:masterfrom
puneetdixit200:feat/std-duration

Conversation

@puneetdixit200

@puneetdixit200 puneetdixit200 commented May 20, 2026

Copy link
Copy Markdown

Summary

  • add Interval::from_std_duration for std::time::Duration
  • share duration-to-interval construction with the existing chrono conversion
  • make duration conversions available without the optional postgres integration feature
  • document the std duration conversion in the README

Verification

  • cargo fmt -- --check
  • cargo test -q
  • cargo test --no-default-features -q
  • cargo test --all-features -q
  • git diff --check

I also ran cargo clippy --all-targets --all-features -- -D warnings; it currently fails on an unrelated pre-existing bool assert comparison in src/interval_parse/postgres.rs.

AI disclosure: This contribution was prepared with assistance from OpenAI GPT-5 under human review.

Closes #74

Add Interval::from_std_duration for standard library durations and share the interval construction path with the existing chrono conversion.

This also makes duration conversions available without the optional postgres integration feature.

Closes rust-postgres-interval#74

Assisted-by: OpenAI Codex (GPT-5) <noreply@openai.com>

Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
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.

Support standard library Duration

1 participant