-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Reduce the size of the future returned by async get_with
and friend methods (v0.10)
#220
Conversation
Correct a wrong `TypeId` for `optionally_get_with`.
Hm, The usage of macros is very interesting, I haven’t thought of that one. Though admittedly it is a bit sad that futures have such an overhead that one workaround is to replace them with something as unergonomic as macros. :-D |
Change the type of the `init` future argument for internal `async fn`s from `Future<...>` to `Pin<&mut Future<...>>`.
get_with
and friend methodsget_with
and friend methods (v0.10)
Change the macros back to private functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge this into the master
branch once all CI jobs are completed. I will do a squash merge.
This PR will mitigate #212 for upcoming Moka v0.10.0 release.
Changes
This PR does the same thing to PR #222, but on the
master
branch instead of themaint-09
branch.future::Cache
:rustc
's optimization issue, switched the internally using type for theinit
future fromimpl Future
to a referencePin<&mut impl Future>
.ValueInitializer:init_or_read(..., init, ...)
from the call path.Updated Methods:
future::Cache
:get_with(...)
get_with_if(...)
optionally_get_with(...)
try_get_with(...)
get_with_by_ref(...)
optionally_get_with_by_ref(...)
try_get_with_by_ref(...)
entry(...).or_insert_with(...)
entry(...).or_insert_with_if(...)
entry(...).or_optionally_insert_with(...)
entry(...).or_try_insert_with(...)
entry_by_ref(...).or_insert_with(...)
entry_by_ref(...).or_insert_with_if(...)
entry_by_ref(...).or_optionally_insert_with(...)
entry_by_ref(...).or_try_insert_with(...)