Skip to content

Fully generalize BTree{Map, Set} range iterators #27545

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

Merged
merged 1 commit into from
Aug 6, 2015
Merged

Fully generalize BTree{Map, Set} range iterators #27545

merged 1 commit into from
Aug 6, 2015

Conversation

apasel422
Copy link
Contributor

This permits collections with String keys to be ranged over with
&str bounds. The K defaults for Min and Max permit the default
type parameter fallback to work with things like

use std::collections::{BTreeSet, Bound};
let set = BTreeSet::<String>::new();
set.range(Bound::Included("a"), Bound::Unbounded);

Without the defaults, the type of the maximum bound would be
unconstrained.

r? @gankro

@apasel422
Copy link
Contributor Author

I have one more commit incoming that simplifies one of the doc examples based on this.

This permits collections with `String` keys to be ranged over with
`&str` bounds. The `K` defaults for `Min` and `Max` permit the default
type parameter fallback to work with things like

```rust
use std::collections::{BTreeSet, Bound};
let set = BTreeSet::<String>::new();
set.range(Bound::Included("a"), Bound::Unbounded);
```

Without the defaults, the type of the maximum bound would be
unconstrained.
@apasel422
Copy link
Contributor Author

Rebased.

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

I favour pushing as much as possible into the where clauses, but I understand this is kinda a lost cause because of ?Sized stuff.

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

(Is that example thing rebased in, or still coming..?)

@apasel422
Copy link
Contributor Author

Yeah the example was updated to remove extra indirections from the strings.

On Wednesday, August 5, 2015, Alexis Beingessner [email protected]
wrote:

(Is that example thing rebased in, or still coming..?)


Reply to this email directly or view it on GitHub
#27545 (comment).

@Gankra
Copy link
Contributor

Gankra commented Aug 5, 2015

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Aug 5, 2015

📌 Commit 4fdeb35 has been approved by Gankro

@bors
Copy link
Collaborator

bors commented Aug 6, 2015

⌛ Testing commit 4fdeb35 with merge 4278b5f...

bors added a commit that referenced this pull request Aug 6, 2015
This permits collections with `String` keys to be ranged over with
`&str` bounds. The `K` defaults for `Min` and `Max` permit the default
type parameter fallback to work with things like

```rust
use std::collections::{BTreeSet, Bound};
let set = BTreeSet::<String>::new();
set.range(Bound::Included("a"), Bound::Unbounded);
```

Without the defaults, the type of the maximum bound would be
unconstrained.

r? @gankro
@bors bors merged commit 4fdeb35 into rust-lang:master Aug 6, 2015
@apasel422 apasel422 deleted the btree-range branch August 6, 2015 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants