Skip to content

Enable specialization of NetworkDuration factories - #298

Open
josephnoir wants to merge 1 commit into
apple:mainfrom
josephnoir:inlinable-nanoseconds
Open

josephnoir wants to merge 1 commit into
apple:mainfrom
josephnoir:inlinable-nanoseconds

Conversation

@josephnoir

Copy link
Copy Markdown
Contributor

The factories to create a NetworkDuration from a BinaryInteger are generic but not inlinable and depend on private symbols. swift-nio-quic needs to initialize a new duration when scheduling a task. While we can work around this (apple/swift-nio-quic#135), that might come with its own problems.

Making the factories inlinable would be a welcome change.

@josephnoir josephnoir added the 🆕 semver/minor Adds new public API. label Nov 2, 2026

@fabianfett fabianfett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need more @inlinable

@josephnoir

Copy link
Copy Markdown
Contributor Author

The last commit does a bit of juggling to make the initializer inlinable. I think it would be fine to make the nanoseconds property (and the initializer) public, but didn't want to do so without getting input on that change first.

@rpaulo

rpaulo commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

I think it would be fine to make the nanoseconds property (and the initializer) public, but didn't want to do so without getting input on that change first.

I think I would prefer that.

@josephnoir
josephnoir force-pushed the inlinable-nanoseconds branch 2 times, most recently from af1deae to 27c1464 Compare November 12, 2026 16:28
The factories to create a `NetworkDuration` from a `BinaryInteger` are
generic but not inlinable and depend on private symbols. swift-nio-quic
needs to initialize a new duration when scheduling a task. While we can
work around this (apple/swift-nio-quic#135),
that might come with its own problems.

Making the factories inlinable would be a welcome change.
@josephnoir
josephnoir force-pushed the inlinable-nanoseconds branch from 27c1464 to ebbddcb Compare November 13, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants