-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added DefaultBtreeMap
and a set_default
method.
#10
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
- Coverage 98.11% 95.97% -2.15%
==========================================
Files 1 2 +1
Lines 159 273 +114
==========================================
+ Hits 156 262 +106
- Misses 3 11 +8
Continue to review full report at Codecov.
|
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.
Thanks for the work on this, but the way this PR is currently structered makes it very hard to review. Mainly because it does all kinds of refactors together with functionality changes. Can you change this PR to only do functionality changes?
Also, I just merged another PR with serde support. Please update this PR to include that as well.
src/btreemap.rs
Outdated
@@ -0,0 +1,462 @@ | |||
/*! |
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.
This commment should only be part of the main module. It just clutters the docs if it's on every page.
src/hashmap.rs
Outdated
``` | ||
*/ | ||
|
||
use std::borrow::Borrow; |
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.
Can you leave the hashmap implementation in the src/lib.rs
file? Now I have no clue what you changed here, because the git diff shows it all as new.
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.
To clarify, you want only the hashmap in src/lib.rs
? (Hashmap code wasn't changed, just copied+pasted.)
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.
yeah, I think I'll move it to a separate file after merging this like you did. But to be able to review the PR easily I'd like the changes to be minimal.
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.
So with that the final changes should be:
- Add
set_default
toDefaultHashMap
insrc/lib.rs
- Add a
src/btreemap.rs
with your new btree code (with serde support copy pasted from defaulthashmap too).
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.
Yep, makes sense. In retrospect, I should have made two PRs: one for DefaultBTreeMap
and one for set_default
.
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.
Yeah that would have been even better, but set_default
is small enough that it's fine to have them together this time.
src/lib.rs
Outdated
//! This is a problem for the first addition when there's no value for the key yet. | ||
//! With this library you can specify when creating the map that the default value should be zero. | ||
//! | ||
/*! |
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.
Please leave the commenting style the same, so //!
instead of /*!
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.
facepalm Of course!
@JelteF Since I am revisiting this PR, I might as well "do it right." There are a few more methods from
The While I am at it, should I implement the missing
I have excluded methods related to using a custom And since I am thinking about this, I would also like to implement an alternative semantics indicated by a new enum with variants |
I would say lets do those extra methods in an upcoming PR, since there might be more discussion points. |
You could create the PR already if you want though, but I don't think it should block merging this PR. |
Bit of a noob question, but how do I rebase my changes to the new upstream commit and keep the PR clean? Normally I would put my changes on a new branch, reset master to before my changes, |
Force push to the same branch as the PR will update the PR automatically.
So the flow you describe is what you want indeed.
…On Mon, 7 Sep 2020, 21:19 Robert Jacobson, ***@***.***> wrote:
Bit of a noob question, but how do I rebase my changes to the new upstream
commit and keep the PR clean? Normally I would put my changes on a new
branch, reset master to before my changes, git pull the upstream commits,
and then rebase my new changes branch onto the updated master branch. But
then to sync my github repo, wouldn't I have to git push --force? Then
what happens to the PR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAI3YJTHF5TGNV64DX6UMADSEUW4RANCNFSM4QPYSS3Q>
.
|
Thanks. I'll do that and squash my commits. |
…shMap` and `DefaultBTreeMap`.
Released this as 0.5.0 |
Added
DefaultBtreeMap
and aset_default
method to bothHashMap
andDefaultBTreeMap
.