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

Add 'by_ref' api #190

Merged
merged 1 commit into from
Oct 31, 2022
Merged

Add 'by_ref' api #190

merged 1 commit into from
Oct 31, 2022

Conversation

LMJW
Copy link
Contributor

@LMJW LMJW commented Oct 30, 2022

Related issue #185

Add "by_ref" version of api for "get_with", "get_with_if", "try_get_with", "optionally_get_with"

@LMJW
Copy link
Contributor Author

LMJW commented Oct 30, 2022

CI failure.

thread 'sync::cache::tests::test_key_lock_used_by_immediate_removal_notifications' panicked at 'assertion failed: `(left == right)`
  left: `Invalidate("a2")`,
 right: `EndNotify("a0", Expired)`: expected[4]', src/sync/cache.rs:3811:13

This might not related to the change

@tatsuya6502 tatsuya6502 self-requested a review October 30, 2022 11:57
@tatsuya6502 tatsuya6502 added the enhancement New feature or request label Oct 30, 2022
@tatsuya6502 tatsuya6502 added this to the v0.9.5 milestone Oct 30, 2022
@tatsuya6502 tatsuya6502 linked an issue Oct 30, 2022 that may be closed by this pull request
Copy link
Member

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

I will run pre-release tests tonight (UTC+0800), and if it goes well, I will release v0.9.5.

Just FYI, I will probably hide (comment out) get_with_if_by_ref for v0.9.5. I am planing to deprecate get_with_if once the entry/entry_by_ref API are ready (v0.10.0?). The same functionality to get_with_if will be provided via entry* APIs. I would like to avoid adding get_with_if_by_ref and then deprecating immediately. I will not remove your code but comment out as we can use it in the entry* APIs.

@tatsuya6502 tatsuya6502 merged commit 8d0e18c into moka-rs:master Oct 31, 2022
@LMJW
Copy link
Contributor Author

LMJW commented Oct 31, 2022

Thanks for approving the PR. If I knew it would be deperacated, I would probably not add the new api for the deprecated function. No worries. You can remove it if it is not needed :)

@tatsuya6502
Copy link
Member

OK. All tests passed and I published v0.9.5 to crates.io. You will see optionally_get_with_by_ref in the doc.

Thanks for your contribution!

@LMJW
Copy link
Contributor Author

LMJW commented Nov 1, 2022

Nice! Thanks for your review. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is it worth to modify the key of get_with as a &K rather than K?
2 participants