Skip to content

Commit

Permalink
[framework] vector zip destroy_empty + allow return values in lambdas (
Browse files Browse the repository at this point in the history
…#20745)

## Description 

- adds `v2.destroy_empty` in `zip_do` to support destroying vectors of
non-droppable `T`s
- allows return values in lambdas as a convenience feature to not wrap
lambdas into braces
- slight boost in performance of `vector::do!` by using `.length()` just
once

## Test plan 

- features tests

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] gRPC:
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:

---------

Co-authored-by: ronny-mysten <[email protected]>
  • Loading branch information
damirka and ronny-mysten authored Jan 25, 2025
1 parent 9595c00 commit d7704d4
Show file tree
Hide file tree
Showing 23 changed files with 236 additions and 167 deletions.
4 changes: 2 additions & 2 deletions crates/sui-framework/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ If changes need to be made to the framework's Move code, additional actions need

### Snapshot tests update

Run the following commands in Sui's [root directory](../../) and accept the changes, if any (if you do not have `cargo-insta` command installed, please run the `cargo install cargo-insta` command first):
Run the following script from the Sui's [root directory](../../) and accept any changes (if you do not have `cargo-insta` installed, run the `cargo install cargo-insta` command first):

```bash
cargo insta test -p sui-swarm-config --review
./scripts/update_all_snapshots.sh
```

Please use your best judgment to decide if the changes between old and new versions of the snapshots look "reasonable" (e.g., a minor change in gas costs). When in doubt, please reach out to a member of Sui core team.
32 changes: 16 additions & 16 deletions crates/sui-framework/docs/std/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_max">num_max</a>($x: _, $y: _): _
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_max">num_max</a>&lt;$T&gt;($x: $T, $y: $T): $T
</code></pre>


Expand All @@ -49,7 +49,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_max">num_max</a>($x: _, $y: _): _ {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_max">num_max</a>&lt;$T&gt;($x: $T, $y: $T): $T {
<b>let</b> x = $x;
<b>let</b> y = $y;
<b>if</b> (x &gt; y) x
Expand All @@ -67,7 +67,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_min">num_min</a>($x: _, $y: _): _
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_min">num_min</a>&lt;$T&gt;($x: $T, $y: $T): $T
</code></pre>


Expand All @@ -76,7 +76,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_min">num_min</a>($x: _, $y: _): _ {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_min">num_min</a>&lt;$T&gt;($x: $T, $y: $T): $T {
<b>let</b> x = $x;
<b>let</b> y = $y;
<b>if</b> (x &lt; y) x
Expand All @@ -94,7 +94,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_diff">num_diff</a>($x: _, $y: _): _
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_diff">num_diff</a>&lt;$T&gt;($x: $T, $y: $T): $T
</code></pre>


Expand All @@ -103,7 +103,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_diff">num_diff</a>($x: _, $y: _): _ {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_diff">num_diff</a>&lt;$T&gt;($x: $T, $y: $T): $T {
<b>let</b> x = $x;
<b>let</b> y = $y;
<b>if</b> (x &gt; y) x - y
Expand All @@ -121,7 +121,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_divide_and_round_up">num_divide_and_round_up</a>($x: _, $y: _): _
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_divide_and_round_up">num_divide_and_round_up</a>&lt;$T&gt;($x: $T, $y: $T): $T
</code></pre>


Expand All @@ -130,7 +130,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_divide_and_round_up">num_divide_and_round_up</a>($x: _, $y: _): _ {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_num_divide_and_round_up">num_divide_and_round_up</a>&lt;$T&gt;($x: $T, $y: $T): $T {
<b>let</b> x = $x;
<b>let</b> y = $y;
<b>if</b> (x % y == 0) x / y
Expand Down Expand Up @@ -255,7 +255,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do">range_do</a>($start: _, $stop: _, $f: |_| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do">range_do</a>&lt;$T, $R: drop&gt;($start: $T, $stop: $T, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -264,7 +264,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do">range_do</a>($start: _, $stop: _, $f: |_|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do">range_do</a>&lt;$T, $R: drop&gt;($start: $T, $stop: $T, $f: |$T| -&gt; $R) {
<b>let</b> <b>mut</b> i = $start;
<b>let</b> stop = $stop;
<b>while</b> (i &lt; stop) {
Expand All @@ -284,7 +284,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do_eq">range_do_eq</a>($start: _, $stop: _, $f: |_| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do_eq">range_do_eq</a>&lt;$T, $R: drop&gt;($start: $T, $stop: $T, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -293,7 +293,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do_eq">range_do_eq</a>($start: _, $stop: _, $f: |_|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_range_do_eq">range_do_eq</a>&lt;$T, $R: drop&gt;($start: $T, $stop: $T, $f: |$T| -&gt; $R) {
<b>let</b> <b>mut</b> i = $start;
<b>let</b> stop = $stop;
// we check `i &gt;= stop` inside the <b>loop</b> instead of `i &lt;= stop` <b>as</b> `<b>while</b>` condition to avoid
Expand All @@ -319,7 +319,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do">do</a>($stop: _, $f: |_| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do">do</a>&lt;$T, $R: drop&gt;($stop: $T, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -328,7 +328,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do">do</a>($stop: _, $f: |_|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do">do</a>&lt;$T, $R: drop&gt;($stop: $T, $f: |$T| -&gt; $R) {
<a href="../std/macros.md#std_macros_range_do">range_do</a>!(0, $stop, $f)
}
</code></pre>
Expand All @@ -343,7 +343,7 @@ This module holds shared implementation of macros used in <code>std</code>



<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do_eq">do_eq</a>($stop: _, $f: |_| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do_eq">do_eq</a>&lt;$T, $R: drop&gt;($stop: $T, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -352,7 +352,7 @@ This module holds shared implementation of macros used in <code>std</code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do_eq">do_eq</a>($stop: _, $f: |_|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/macros.md#std_macros_do_eq">do_eq</a>&lt;$T, $R: drop&gt;($stop: $T, $f: |$T| -&gt; $R) {
<a href="../std/macros.md#std_macros_range_do_eq">range_do_eq</a>!(0, $stop, $f)
}
</code></pre>
Expand Down
22 changes: 11 additions & 11 deletions crates/sui-framework/docs/std/option.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ and an empty vector otherwise
Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</code> and call the closure <code>f</code> on the value inside if it holds one.


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_destroy">destroy</a>&lt;$T&gt;($o: <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |$T| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_destroy">destroy</a>&lt;$T, $R: drop&gt;($o: <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -578,7 +578,7 @@ Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_destroy">destroy</a>&lt;$T&gt;($o: <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |$T|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_destroy">destroy</a>&lt;$T, $R: drop&gt;($o: <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |$T| -&gt; $R) {
<b>let</b> o = $o;
o.<a href="../std/option.md#std_option_do">do</a>!($f);
}
Expand All @@ -595,7 +595,7 @@ Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</
Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</code> and call the closure <code>f</code> on the value inside if it holds one.


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do">do</a>&lt;$T&gt;($o: <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |$T| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do">do</a>&lt;$T, $R: drop&gt;($o: <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |$T| -&gt; $R)
</code></pre>


Expand All @@ -604,9 +604,9 @@ Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do">do</a>&lt;$T&gt;($o: <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |$T|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do">do</a>&lt;$T, $R: drop&gt;($o: <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |$T| -&gt; $R) {
<b>let</b> o = $o;
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) $f(o.<a href="../std/option.md#std_option_destroy_some">destroy_some</a>())
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) { $f(o.<a href="../std/option.md#std_option_destroy_some">destroy_some</a>()); }
<b>else</b> o.<a href="../std/option.md#std_option_destroy_none">destroy_none</a>()
}
</code></pre>
Expand All @@ -622,7 +622,7 @@ Destroy <code><a href="../std/option.md#std_option_Option">Option</a>&lt;T&gt;</
Execute a closure on the value inside <code>t</code> if it holds one.


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_ref">do_ref</a>&lt;$T&gt;($o: &<a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |&$T| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_ref">do_ref</a>&lt;$T, $R: drop&gt;($o: &<a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |&$T| -&gt; $R)
</code></pre>


Expand All @@ -631,9 +631,9 @@ Execute a closure on the value inside <code>t</code> if it holds one.
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_ref">do_ref</a>&lt;$T&gt;($o: &<a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |&$T|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_ref">do_ref</a>&lt;$T, $R: drop&gt;($o: &<a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |&$T| -&gt; $R) {
<b>let</b> o = $o;
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) $f(o.<a href="../std/option.md#std_option_borrow">borrow</a>());
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) { $f(o.<a href="../std/option.md#std_option_borrow">borrow</a>()); }
}
</code></pre>

Expand All @@ -648,7 +648,7 @@ Execute a closure on the value inside <code>t</code> if it holds one.
Execute a closure on the mutable reference to the value inside <code>t</code> if it holds one.


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_mut">do_mut</a>&lt;$T&gt;($o: &<b>mut</b> <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |&<b>mut</b> $T| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_mut">do_mut</a>&lt;$T, $R: drop&gt;($o: &<b>mut</b> <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;$T&gt;, $f: |&<b>mut</b> $T| -&gt; $R)
</code></pre>


Expand All @@ -657,9 +657,9 @@ Execute a closure on the mutable reference to the value inside <code>t</code> if
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_mut">do_mut</a>&lt;$T&gt;($o: &<b>mut</b> <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |&<b>mut</b> $T|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/option.md#std_option_do_mut">do_mut</a>&lt;$T, $R: drop&gt;($o: &<b>mut</b> <a href="../std/option.md#std_option_Option">Option</a>&lt;$T&gt;, $f: |&<b>mut</b> $T| -&gt; $R) {
<b>let</b> o = $o;
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) $f(o.<a href="../std/option.md#std_option_borrow_mut">borrow_mut</a>());
<b>if</b> (o.<a href="../std/option.md#std_option_is_some">is_some</a>()) { $f(o.<a href="../std/option.md#std_option_borrow_mut">borrow_mut</a>()); }
}
</code></pre>

Expand Down
16 changes: 8 additions & 8 deletions crates/sui-framework/docs/std/u128.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ Maximum value for a <code><a href="../std/u128.md#std_u128">u128</a></code>
Loops applying <code>$f</code> to each number from <code>$start</code> to <code>$stop</code> (exclusive)


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do">range_do</a>($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do">range_do</a>&lt;$R: drop&gt;($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R)
</code></pre>


Expand All @@ -396,7 +396,7 @@ Loops applying <code>$f</code> to each number from <code>$start</code> to <code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do">range_do</a>($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do">range_do</a>&lt;$R: drop&gt;($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R) {
<a href="../std/macros.md#std_macros_range_do">std::macros::range_do</a>!($start, $stop, $f)
}
</code></pre>
Expand All @@ -412,7 +412,7 @@ Loops applying <code>$f</code> to each number from <code>$start</code> to <code>
Loops applying <code>$f</code> to each number from <code>$start</code> to <code>$stop</code> (inclusive)


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do_eq">range_do_eq</a>($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do_eq">range_do_eq</a>&lt;$R: drop&gt;($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R)
</code></pre>


Expand All @@ -421,7 +421,7 @@ Loops applying <code>$f</code> to each number from <code>$start</code> to <code>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do_eq">range_do_eq</a>($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_range_do_eq">range_do_eq</a>&lt;$R: drop&gt;($start: <a href="../std/u128.md#std_u128">u128</a>, $stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R) {
<a href="../std/macros.md#std_macros_range_do_eq">std::macros::range_do_eq</a>!($start, $stop, $f)
}
</code></pre>
Expand All @@ -437,7 +437,7 @@ Loops applying <code>$f</code> to each number from <code>$start</code> to <code>
Loops applying <code>$f</code> to each number from <code>0</code> to <code>$stop</code> (exclusive)


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do">do</a>($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do">do</a>&lt;$R: drop&gt;($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R)
</code></pre>


Expand All @@ -446,7 +446,7 @@ Loops applying <code>$f</code> to each number from <code>0</code> to <code>$stop
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do">do</a>($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do">do</a>&lt;$R: drop&gt;($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R) {
<a href="../std/macros.md#std_macros_do">std::macros::do</a>!($stop, $f)
}
</code></pre>
Expand All @@ -462,7 +462,7 @@ Loops applying <code>$f</code> to each number from <code>0</code> to <code>$stop
Loops applying <code>$f</code> to each number from <code>0</code> to <code>$stop</code> (inclusive)


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do_eq">do_eq</a>($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; ())
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do_eq">do_eq</a>&lt;$R: drop&gt;($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R)
</code></pre>


Expand All @@ -471,7 +471,7 @@ Loops applying <code>$f</code> to each number from <code>0</code> to <code>$stop
<summary>Implementation</summary>


<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do_eq">do_eq</a>($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>|) {
<pre><code><b>public</b> <b>macro</b> <b>fun</b> <a href="../std/u128.md#std_u128_do_eq">do_eq</a>&lt;$R: drop&gt;($stop: <a href="../std/u128.md#std_u128">u128</a>, $f: |<a href="../std/u128.md#std_u128">u128</a>| -&gt; $R) {
<a href="../std/macros.md#std_macros_do_eq">std::macros::do_eq</a>!($stop, $f)
}
</code></pre>
Expand Down
Loading

0 comments on commit d7704d4

Please sign in to comment.