Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime#signed_duration_since should borrow instead of consume self and other #573

Open
rkofman opened this issue Jul 3, 2021 · 0 comments
Labels
API-incompatible Tracking changes that need incompatible API revisions

Comments

@rkofman
Copy link

rkofman commented Jul 3, 2021

I'm very new to Rust, so this could be misunderstanding the language and/or the library, but it seems that DateTime#signed_duration_since could borrow the value as read-only since it is a non-mutating action (or DateTime could implement the Copy trait).

As is, clients are forced to clone() both the left and right side of the expression -- which seems like an unnecessary requirement for a method that calculates their difference and returns an OldDuration.

I'm happy to create a PR that adds a borrowed_signed_duration_since interface (to avoid a breaking change in the existing interface), but would appreciate somebody with more experience to first chime in and let me know that it's a reasonable change. This would be my first Rust PR.

:o)

@pitdicker pitdicker added the API-incompatible Tracking changes that need incompatible API revisions label Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-incompatible Tracking changes that need incompatible API revisions
Projects
None yet
Development

No branches or pull requests

2 participants