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

Implement add and subtract methods for Duration #74

Merged
merged 3 commits into from
Jul 7, 2024

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Jul 7, 2024

Related to ongoing work for #11

As it says in the title, implementing the add and subtract methods for duration.

@nekevss nekevss added the C-enhancement New feature or request label Jul 7, 2024
@nekevss nekevss added this to the 0.1 Blocking milestone Jul 7, 2024
@nekevss nekevss added the C-api Changes related to the public API label Jul 7, 2024
Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Everything looks great! I just have a small nit.

/// Returns the result of adding a `Duration` to the current `Duration`
#[inline]
pub fn add(&self, other: &Self) -> TemporalResult<Self> {
self.internal_add(other)
Copy link
Member

@jedel1043 jedel1043 Jul 7, 2024

Choose a reason for hiding this comment

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

Nit: do we need to have an internal_add method? I think it would be cleaner to move the code of internal_add to add, then just call self.add(other.negated()) for subtract.

@nekevss nekevss merged commit d47fdaf into main Jul 7, 2024
5 checks passed
@jedel1043 jedel1043 deleted the duration-add-subtract branch July 7, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-api Changes related to the public API C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants