-
Notifications
You must be signed in to change notification settings - Fork 17
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 extra tests / examples of lockable ranges #58
Conversation
Add range iterator example Add locked values re-mapping example Add locked values skipping example
fb1a7f8
to
4ecf6b6
Compare
2fce5fb
to
5ce8463
Compare
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.
LGTM
.unwrap_err(); | ||
assert_eq!(err, TestsError::Lock(LockError::WriteLocked)); | ||
|
||
// But we can re-map (perhaps not a good idea) the write-locked values |
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.
Nice to explain what is and is not possible here
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.
One more idea after merging...
.unwrap(); | ||
assert_eq!(collaterals.len(), 3); | ||
|
||
// Or we can skip (perhaps not a good idea either) the write-locked values |
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.
Reflecting more on this, I think the best would be to return:
enum MaybeAccount {
Account(Account),
Locked{ user: String },
}
Or something Similar. (Not sure how you use the keys).
I can make an example as follow up PR (unless this makes sense to you and you want to try)
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.
👍🏼 Will implement this for reference / as an example.
Some more tests / examples of using our new
Lockable
primitive in range iterators.Found useful writing these to reason about and learn how to use them.