Skip to content

Commit

Permalink
(automated) deploy from commit 97bcc0a
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tiny-kirin committed Jun 16, 2024
1 parent 23bb8c0 commit 55a99b0
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 119 deletions.
22 changes: 19 additions & 3 deletions src/wiwi/iter/size_hint.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@
<a href="#217" id="217">217</a>
<a href="#218" id="218">218</a>
<a href="#219" id="219">219</a>
<a href="#220" id="220">220</a>
<a href="#221" id="221">221</a>
<a href="#222" id="222">222</a>
<a href="#223" id="223">223</a>
<a href="#224" id="224">224</a>
<a href="#225" id="225">225</a>
<a href="#226" id="226">226</a>
<a href="#227" id="227">227</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::Iter;

<span class="attr">#[derive(Debug)]
Expand Down Expand Up @@ -272,7 +280,7 @@

<span class="attr">#[inline]
</span><span class="kw">unsafe fn </span>single(bound: SizeHintBound) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>::with_inner(SizeHintInner::Lower { bound })
<span class="self">Self</span>::with_inner(SizeHintInner::Single { bound })
}

<span class="attr">#[inline]
Expand Down Expand Up @@ -327,12 +335,20 @@

<span class="attr">#[inline]
</span><span class="kw">pub unsafe fn </span>range_hard(lower: usize, upper: usize) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>::range(SizeHintBound::Hard { count: lower }, SizeHintBound::Hard { count: upper })
<span class="kw">if </span>lower == upper {
<span class="self">Self</span>::single(SizeHintBound::Hard { count: lower })
} <span class="kw">else </span>{
<span class="self">Self</span>::range(SizeHintBound::Hard { count: lower }, SizeHintBound::Hard { count: upper })
}
}

<span class="attr">#[inline]
</span><span class="kw">pub unsafe fn </span>range_estimate(lower: usize, upper: usize) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>::range(SizeHintBound::Estimate { count: lower }, SizeHintBound::Estimate { count: upper })
<span class="kw">if </span>lower == upper {
<span class="self">Self</span>::single(SizeHintBound::Estimate { count: lower })
} <span class="kw">else </span>{
<span class="self">Self</span>::range(SizeHintBound::Estimate { count: lower }, SizeHintBound::Estimate { count: upper })
}
}

<span class="attr">#[inline]
Expand Down
220 changes: 107 additions & 113 deletions src/wiwi/iter/tuple.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,6 @@
<a href="#645" id="645">645</a>
<a href="#646" id="646">646</a>
<a href="#647" id="647">647</a>
<a href="#648" id="648">648</a>
<a href="#649" id="649">649</a>
<a href="#650" id="650">650</a>
</pre></div><pre class="rust"><code><span class="kw">use super</span>::{ IntoIter, Iter, SizeHintBound, SizeHintImpl, SizeHintInner, SizeHintMarker };
<span class="kw">use </span>std::ptr;

Expand Down Expand Up @@ -1171,116 +1168,113 @@
</span><span class="kw">mod </span>tests {
<span class="kw">use super</span>::<span class="kw-2">*</span>;

<span class="comment">// #[test]
// fn min_size_hint() {
// struct Checker {
// h1: SizeHint,
// h2: SizeHint,
// expected: SizeHint,
// }

// impl Checker {
// fn check(self) {
// let Self { h1, h2, expected } = self;

// // check both ways
// assert_eq!(unsafe { super::min_size_hint(h1.clone(), h2.clone()) }, expected);
// assert_eq!(unsafe { super::min_size_hint(h2, h1) }, expected);
// }
// }

// unsafe {
// // all unknown
// Checker {
// h1: SizeHint::unknown(),
// h2: SizeHint::unknown(),
// expected: SizeHint::unknown()
// }.check();

// // one lower or upper estimate
// Checker {
// h1: SizeHint::new().with_lower_estimate(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::new().with_lower_estimate(10)
// }.check();
// Checker {
// h1: SizeHint::new().with_upper_estimate(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::new().with_upper_estimate(10)
// }.check();

// // one both estimate
// Checker {
// h1: SizeHint::estimate(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::estimate(10)
// }.check();

// // one lower, other upper estimate
// Checker {
// h1: SizeHint::new().with_lower_estimate(10),
// h2: SizeHint::new().with_upper_estimate(10),
// expected: SizeHint::estimate(10)
// }.check();

// // hard bound + unknown
// Checker {
// h1: SizeHint::new().with_lower_hard_bound(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::new().with_lower_estimate(10)
// }.check();
// Checker {
// h1: SizeHint::new().with_upper_hard_bound(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::new().with_upper_estimate(10)
// }.check();
// Checker {
// h1: SizeHint::hard_bound(10),
// h2: SizeHint::unknown(),
// expected: SizeHint::estimate(10)
// }.check();

// // hard bound + estimate
// Checker {
// h1: SizeHint::new().with_lower_hard_bound(10),
// h2: SizeHint::new().with_upper_estimate(10),
// expected: SizeHint::estimate(10)
// }.check();
// Checker {
// h1: SizeHint::new().with_upper_hard_bound(10),
// h2: SizeHint::new().with_lower_estimate(10),
// expected: SizeHint::estimate(10)
// }.check();

// // differing estimates
// Checker {
// h1: SizeHint::new().with_lower_estimate(10).with_upper_estimate(5),
// h2: SizeHint::new().with_upper_estimate(10).with_lower_estimate(5),
// expected: SizeHint::estimate(5)
// }.check();

// // differing hard
// Checker {
// h1: SizeHint::new().with_lower_hard_bound(10).with_upper_hard_bound(5),
// h2: SizeHint::new().with_upper_hard_bound(10).with_lower_hard_bound(5),
// expected: SizeHint::hard_bound(5)
// }.check();

// // differing hard + estimate
// Checker {
// h1: SizeHint::new().with_lower_hard_bound(10).with_upper_hard_bound(7),
// h2: SizeHint::new().with_upper_estimate(12).with_lower_estimate(9),
// expected: SizeHint::new().with_lower_estimate(9).with_upper_estimate(7)
// }.check();
// Checker {
// h1: SizeHint::new().with_upper_hard_bound(10).with_lower_estimate(7),
// h2: SizeHint::new().with_upper_estimate(12).with_lower_hard_bound(9),
// expected: SizeHint::new().with_upper_estimate(10).with_lower_estimate(7)
// }.check();
// }
// }

</span><span class="attr">#[test]
<span class="attr">#[test]
</span><span class="kw">fn </span>min_size_hint() {
<span class="macro">macro_rules!</span> check {
{
h1: <span class="macro-nonterminal">$h1</span>:expr,
h2: <span class="macro-nonterminal">$h2</span>:expr,
expected: <span class="macro-nonterminal">$expected</span>:expr
} =&gt; {
<span class="kw">unsafe </span>{
<span class="macro">assert_eq!</span>(<span class="kw">super</span>::min_size_hint(<span class="macro-nonterminal">$h1</span>, <span class="macro-nonterminal">$h2</span>), <span class="macro-nonterminal">$expected</span>);
<span class="macro">assert_eq!</span>(<span class="kw">super</span>::min_size_hint(<span class="macro-nonterminal">$h2</span>, <span class="macro-nonterminal">$h1</span>), <span class="macro-nonterminal">$expected</span>);
}
}
}


<span class="comment">// all unknown
</span><span class="macro">check!</span> {
h1: SizeHintImpl::unknown(),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::unknown()
}

<span class="comment">// one lower or upper estimate
</span><span class="macro">check!</span> {
h1: SizeHintImpl::lower_estimate(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::lower_estimate(<span class="number">10</span>)
}
<span class="macro">check!</span> {
h1: SizeHintImpl::upper_estimate(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::upper_estimate(<span class="number">10</span>)
}

<span class="comment">// one both estimate
</span><span class="macro">check!</span> {
h1: SizeHintImpl::estimate(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::estimate(<span class="number">10</span>)
}

<span class="comment">// one lower, other upper estimate
</span><span class="macro">check!</span> {
h1: SizeHintImpl::lower_estimate(<span class="number">10</span>),
h2: SizeHintImpl::upper_estimate(<span class="number">10</span>),
expected: SizeHintImpl::estimate(<span class="number">10</span>)
}

<span class="comment">// // hard bound + unknown
</span><span class="macro">check!</span> {
h1: SizeHintImpl::lower_hard(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::lower_estimate(<span class="number">10</span>)
}
<span class="macro">check!</span> {
h1: SizeHintImpl::upper_hard(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::upper_estimate(<span class="number">10</span>)
}
<span class="macro">check!</span> {
h1: SizeHintImpl::hard(<span class="number">10</span>),
h2: SizeHintImpl::unknown(),
expected: SizeHintImpl::estimate(<span class="number">10</span>)
}

<span class="comment">// hard bound + estimate
</span><span class="macro">check!</span> {
h1: SizeHintImpl::lower_hard(<span class="number">10</span>),
h2: SizeHintImpl::upper_estimate(<span class="number">10</span>),
expected: SizeHintImpl::estimate(<span class="number">10</span>)
}
<span class="macro">check!</span> {
h1: SizeHintImpl::upper_hard(<span class="number">10</span>),
h2: SizeHintImpl::lower_estimate(<span class="number">10</span>),
expected: SizeHintImpl::estimate(<span class="number">10</span>)
}

<span class="comment">// differing estimates
</span><span class="macro">check!</span> {
<span class="comment">// actual range values makes no sense, but whatever lol
</span>h1: SizeHintImpl::range_estimate(<span class="number">10</span>, <span class="number">5</span>),
h2: SizeHintImpl::range_estimate(<span class="number">5</span>, <span class="number">10</span>),
expected: SizeHintImpl::estimate(<span class="number">5</span>)
}

<span class="comment">// differing hard
</span><span class="macro">check!</span> {
h1: SizeHintImpl::range_hard(<span class="number">10</span>, <span class="number">5</span>),
h2: SizeHintImpl::range_hard(<span class="number">5</span>, <span class="number">10</span>),
expected: SizeHintImpl::hard(<span class="number">5</span>)
}

<span class="comment">// differing hard + estimate
</span><span class="macro">check!</span> {
h1: SizeHintImpl::range_hard(<span class="number">10</span>, <span class="number">7</span>),
h2: SizeHintImpl::range_estimate(<span class="number">9</span>, <span class="number">12</span>),
expected: SizeHintImpl::range_estimate(<span class="number">9</span>, <span class="number">7</span>)
}
<span class="macro">check!</span> {
h1: SizeHintImpl::range_lestimate_uhard(<span class="number">7</span>, <span class="number">10</span>),
h2: SizeHintImpl::range_lhard_uestimate(<span class="number">9</span>, <span class="number">12</span>),
expected: SizeHintImpl::range_estimate(<span class="number">7</span>, <span class="number">10</span>)
}
}

<span class="attr">#[test]
</span><span class="kw">fn </span>size_hint() {
<span class="kw">let </span><span class="kw-2">mut </span>iter = (<span class="macro">vec!</span>[<span class="number">1u8</span>, <span class="number">2</span>, <span class="number">3</span>, <span class="number">4</span>, <span class="number">5</span>], <span class="macro">vec!</span>[<span class="number">7usize</span>, <span class="number">6</span>, <span class="number">5</span>, <span class="number">4</span>, <span class="number">3</span>, <span class="number">2</span>, <span class="number">1</span>]).into_wiwi_iter();

Expand Down
2 changes: 1 addition & 1 deletion wiwi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h3 id="enabled-features-wiwikiwingay"><a class="doc-anchor" href="#enabled-feat
<li><code>to-maybeuninit</code></li>
<li><code>z85</code></li>
</ul>
<p>These docs have been built from commit <a href="https://github.com/meadowsys/wiwi/commit/9e161e70af1974e810c79219efe174cd67903c80">9e161e70</a>.</p>
<p>These docs have been built from commit <a href="https://github.com/meadowsys/wiwi/commit/97bcc0af26ecd209df31d8b4d5f6b1f90bb4a42c">97bcc0af</a>.</p>
<div class="footnotes"><hr><ol><li id="fn1"><p>Based on the benchmark available in this repo: wiwi is about 21.5x faster in encode, and 7.5x faster in decode. I want better benchmarks though. For now the <code>hex</code> crate also provides more flexibility, whereas <code>wiwi::hex</code> just exposes <code>encode_hex</code>, <code>encode_upper_hex</code>, and <code>decode_hex</code> functions.
&nbsp;<a href="#fnref1"></a></p></li><li id="fn2"><p>Based on the benchmark available in this repo: wiwi is about 1.4x faster in encode, and 2.2x faster in decode. I want better benchmarks though. There is no functionality that the <code>z85</code> crate provides, that we don’t also provide (<code>encode_z85</code> and <code>decode_z85</code> functions).&nbsp;<a href="#fnref2"></a></p></li></ol></div></div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="aoc/index.html" title="mod wiwi::aoc">aoc</a><span class="stab portability" title="Available on crate feature `aoc-unstable` only"><code>aoc-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="auth/index.html" title="mod wiwi::auth">auth</a><span class="stab portability" title="Available on crate feature `auth-unstable` only"><code>auth-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="bitstream/index.html" title="mod wiwi::bitstream">bitstream</a><span class="stab portability" title="Available on crate feature `bitstream-unstable` only"><code>bitstream-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="chainer/index.html" title="mod wiwi::chainer">chainer</a><span class="stab portability" title="Available on crate feature `chainer-unstable` only"><code>chainer-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="clock_timer/index.html" title="mod wiwi::clock_timer">clock_timer</a><span class="stab portability" title="Available on crate feature `clock-timer` only"><code>clock-timer</code></span></div><div class="desc docblock-short">An interval tracking clock</div></li><li><div class="item-name"><a class="mod" href="debounce/index.html" title="mod wiwi::debounce">debounce</a><span class="stab portability" title="Available on crate feature `debounce` only"><code>debounce</code></span></div><div class="desc docblock-short">A debounced function; or a function that won’t actually get called until
there haven’t been calls to it for a certain amount of time.</div></li><li><div class="item-name"><a class="mod" href="defer/index.html" title="mod wiwi::defer">defer</a><span class="stab portability" title="Available on crate feature `defer-unstable` only"><code>defer-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="h/index.html" title="mod wiwi::h">h</a><span class="stab portability" title="Available on crate feature `h` only"><code>h</code></span></div><div class="desc docblock-short">h</div></li><li><div class="item-name"><a class="mod" href="hex/index.html" title="mod wiwi::hex">hex</a><span class="stab portability" title="Available on crate feature `hex` only"><code>hex</code></span></div><div class="desc docblock-short">Fast and efficient implementation of hex encoding.</div></li><li><div class="item-name"><a class="mod" href="id/index.html" title="mod wiwi::id">id</a><span class="stab portability" title="Available on crate feature `id-unstable` only"><code>id-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="int/index.html" title="mod wiwi::int">int</a><span class="stab portability" title="Available on crate feature `int-unstable` only"><code>int-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="iter/index.html" title="mod wiwi::iter">iter</a><span class="stab portability" title="Available on crate feature `iter-unstable` only"><code>iter-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="lazy_wrap/index.html" title="mod wiwi::lazy_wrap">lazy_wrap</a><span class="stab portability" title="Available on crate feature `lazy-wrap` only"><code>lazy-wrap</code></span></div><div class="desc docblock-short">Wrapper for initialisation function, initialising it only on first access.</div></li><li><div class="item-name"><a class="mod" href="lsl/index.html" title="mod wiwi::lsl">lsl</a><span class="stab portability" title="Available on crate feature `lsl-unstable` only"><code>lsl-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="memory_usage/index.html" title="mod wiwi::memory_usage">memory_usage</a><span class="stab portability" title="Available on crate feature `memory-usage-unstable` only"><code>memory-usage-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="minesweeper/index.html" title="mod wiwi::minesweeper">minesweeper</a><span class="stab portability" title="Available on crate feature `minesweeper-unstable` only"><code>minesweeper-unstable</code></span></div></li><li><div class="item-name"><a class="mod" href="nominal/index.html" title="mod wiwi::nominal">nominal</a><span class="stab portability" title="Available on crate feature `nominal` only"><code>nominal</code></span></div><div class="desc docblock-short">Generic, zero-cost struct that wraps data in a newtype, to take advantage of
Expand Down
Loading

0 comments on commit 55a99b0

Please sign in to comment.