<p dir="auto">This covers <code class="notranslate">btree_range</code> and <code class="notranslate">collections_bound</code>. Both try to address the combinatorics over inclusive/exclusive/none bounds on ordered queries. I am significantly unsatisfied with the current solution, which is <code class="notranslate">btree.range(Bound(&amp;K), Bound(&amp;K))</code>. This pushes all the combinatorics into a nasty calling convention. Instead, I believe we would be better served by a build pattern:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for x in btree.range().ge(&amp;min).lt(&amp;max) { .. }"><pre class="notranslate"><code class="notranslate">for x in btree.range().ge(&amp;min).lt(&amp;max) { .. }
</code></pre></div>
<p dir="auto">This allows you to avoid importing and dispatching on enum. It also has the advantage of making simpler queries simpler. Compare:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// today (assuming you've totally imported the bound variants)
for x in btree.range(Unbounded, Inclusive(&amp;max)) {

// tomorrow?
for x in btree.range().le(&amp;max) { .. }"><pre class="notranslate"><code class="notranslate">// today (assuming you've totally imported the bound variants)
for x in btree.range(Unbounded, Inclusive(&amp;max)) {

// tomorrow?
for x in btree.range().le(&amp;max) { .. }
</code></pre></div>
<p dir="auto">This also could potentially address <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="94092510" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rfcs/issues/1195" data-hovercard-type="pull_request" data-hovercard-url="/rust-lang/rfcs/pull/1195/hovercard" href="https://github.com/rust-lang/rfcs/pull/1195">rust-lang/rfcs#1195</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="let pred = btree.range().le(&amp;max).get();"><pre class="notranslate"><code class="notranslate">let pred = btree.range().le(&amp;max).get();
</code></pre></div>
<p dir="auto">And can be extended to support <code class="notranslate">drain</code> or <code class="notranslate">remove</code> similarly;</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for x in btree.range_mut().gt(&amp;min).drain() { .. }"><pre class="notranslate"><code class="notranslate">for x in btree.range_mut().gt(&amp;min).drain() { .. }
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ler pred = btree.range_mut().le(&amp;max).remove();"><pre class="notranslate"><code class="notranslate">ler pred = btree.range_mut().le(&amp;max).remove();
</code></pre></div>
<p dir="auto">Which if desirable can be sugarred to direct methods on btree in the future.</p>
<p dir="auto">This compiles:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mod Foo {}
struct Foo;

fn main() {}"><pre class="notranslate"><span class="pl-k">mod</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-k">struct</span> <span class="pl-smi">Foo</span><span class="pl-kos">;</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">but this doesn't:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mod Foo {}
struct Bar;
type Foo = Bar;

fn main() {}"><pre class="notranslate"><span class="pl-k">mod</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-k">struct</span> <span class="pl-smi">Bar</span><span class="pl-kos">;</span>
<span class="pl-k">type</span> <span class="pl-smi">Foo</span> = <span class="pl-smi">Bar</span><span class="pl-kos">;</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:3:1: 3:16 error: duplicate definition of type or module `Foo`
&lt;anon&gt;:3 type Foo = Bar;
         ^~~~~~~~~~~~~~~
&lt;anon&gt;:1:1: 1:11 note: first definition of type or module `Foo` here
&lt;anon&gt;:1 mod Foo {}
         ^~~~~~~~~~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:3:1: 3:16 error: duplicate definition of type or module `Foo`
&lt;anon&gt;:3 type Foo = Bar;
         ^~~~~~~~~~~~~~~
&lt;anon&gt;:1:1: 1:11 note: first definition of type or module `Foo` here
&lt;anon&gt;:1 mod Foo {}
         ^~~~~~~~~~
</code></pre></div>
<p dir="auto">I'd have expected both to either succeed or fail.</p>