Draft
Conversation
Owner
|
Thank you, that is indeed very useful! I did not know about pub trait IndexType: Copy + Display + Sized + Eq {
type T: Copy + Display + Sized + Eq;
fn new(val: usize) -> Self::T;
fn get(val: Self::T) -> usize;
}where |
Author
|
Yeah, the "niche" in NonZeroX is super useful in case you want a zero-cost Option of it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @tprodanov thanks for adding
remove_whereand other changes! While I was working onremove_select, I noticed some things I thought could be improved in the codebase and wanted to see how they would pan out so I went ahead and implemented them. This PR is against the older version of the code. If you are interested in taking any/all of these changes, I'd be happy to rebase or break out any subset of the changes. Here are the major changes:Option<Ix>vsIx. In order to not increase memory footprint,Ixis changed toNonZeroU*. (Option<NonZeroU32>is 4 bytes, same asu32.) I think this is a great improvement to being able to understand the code, catch more programming errors at compile time, and it lead to many opportunities to clarify surrounding code (e.g. withmatchormap). However, I haven't been able to figure out how to preserve the existing API where you can create aRangeMap<X, Y, u64>; consumers would have to be updated to useRangeMap<X, Y, NonZeroU64>. Not sure how impactful this would be for consumers.IntervalMap::nodes[]. Slightly reduces the amount of repeated code, and makes it more clear where nodes are being mutated.swap_nodes().rustfmt.Here is an example where the change is pretty mechanical, with no additional cleanup possible. But you can't forget the
.defined()check and then panic at runtime :)old:
new:
You can see the substantial changes more clearly by looking at just the last commit.