Skip to content

rename constructors of Interval to more explicit names #6

Description

@jimy-byerley

Hello this is me again
I was considering to add so PS to my previoous issue and then though it would be better on a different topic.

the current constructors of Interval are at the moment

  • Interval::new - initialize with a duration and a start instant
  • Interval::new_interval - with duration and current instant as start instant. The name isn't much clear but redundant with its struct name

what about renaming the constructors to:

  • Interval::new(Duration) - initialize with a duration and current instant as start instant.
    Having new with only the duration argument makes it more similar to other interval implementations (egg from tokio or std)
  • Interval::at(Instant, Duration) or Interval::starting or Interval::new_starting - initialize with a duration and a start instant.
    Since this feature is less common in other implementations, this constructor has a specific name

As a user I think it could be more intuitive and comfortable, what do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions