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

Don't expose BoxFuture in public API #1167

Merged
merged 2 commits into from
Dec 17, 2023
Merged

Conversation

oscarwcl
Copy link
Contributor

Based on #1166

ObjectStore::get calls itself recursively, so the returned future needs to be boxed. However, this is an implementation detail, there's no reason to expose it in the public API. Instead, we can move the recursive call to a separate get_impl function that handles the boxing, and get can just be a standard async function.

This is a minor stylistic change, but if it's desired it makes sense to land it at the same time as #1166 since that is already a breaking change.

None of these futures are borrowing anything from outside their Box, so
their lifetimes can be 'static. This avoids polluting a bunch of public
types with unnecessary lifetime parameters.
`ObjectStore::get` calls itself recursively, so the returned future
needs to be boxed. However, this is an implementation detail, there's no
reason to expose it in the public API. Instead, we can move the
recursive call to a separate `get_impl` function that handles the
boxing, and `get` can just be a standard async function.
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

@Jarema Jarema merged commit cdb039b into nats-io:main Dec 17, 2023
11 checks passed
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.

2 participants