101010.pl is one of the many independent Mastodon servers you can use to participate in the fediverse.
101010.pl czyli najstarszy polski serwer Mastodon. Posiadamy wpisy do 2048 znaków.

Server stats:

500
active users

#borrowchk

0 posts0 participants0 posts today
Jan :rust: :ferris:<p>Practical suggestions for building <a href="https://floss.social/tags/intuition" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>intuition</span></a> around borrow errors - by quinedot</p><p><a href="https://quinedot.github.io/rust-learning/lifetime-intuition.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">quinedot.github.io/rust-learni</span><span class="invisible">ng/lifetime-intuition.html</span></a></p><p>If you're struggling with the <a href="https://floss.social/tags/Rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Rust</span></a> borrow checker and lifetimes, this is an excellent resource!</p><p>In some past toot I've said that Rust lends itself very well to _intuition-based learning_...</p><p><a href="https://floss.social/@janriemer/109415274612140073" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">floss.social/@janriemer/109415</span><span class="invisible">274612140073</span></a></p><p>...so this learning resource takes the same line (according to its title)! Nice!</p><p><a href="https://floss.social/tags/RustLang" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RustLang</span></a> <a href="https://floss.social/tags/BorrowChk" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BorrowChk</span></a></p>
Jan :rust: :ferris:<p>Obscure Rust: reborrowing is a half-baked feature - by Thoughts with wings (2022-06)</p><p><a href="https://haibane-tenshi.github.io/rust-reborrowing/" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="ellipsis">haibane-tenshi.github.io/rust-</span><span class="invisible">reborrowing/</span></a></p><p><a href="https://floss.social/tags/Rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Rust</span></a> <a href="https://floss.social/tags/RustLang" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RustLang</span></a> <a href="https://floss.social/tags/BorrowChk" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BorrowChk</span></a></p>
Jan :rust: :ferris:<p><span class="h-card"><a href="https://mastodon.social/@wtfrank" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>wtfrank</span></a></span> You can use a concept called "Split Borrows" or "Borrow Splitting":</p><p><a href="https://doc.rust-lang.org/nomicon/borrow-splitting.html" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="ellipsis">doc.rust-lang.org/nomicon/borr</span><span class="invisible">ow-splitting.html</span></a></p><p>Here is a playground that shows it:<br><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=607b3986ab9c04a3b918e55c5a2d2163" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="ellipsis">play.rust-lang.org/?version=st</span><span class="invisible">able&amp;mode=debug&amp;edition=2021&amp;gist=607b3986ab9c04a3b918e55c5a2d2163</span></a></p><p>It boils down to the following:<br>You can split your vector (or rather slice) into two mutable parts and mutate each half individually, by using `split_at_mut` on slices:</p><p>See docs in std:<br><a href="https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut" rel="nofollow noopener" target="_blank"><span class="invisible">https://</span><span class="ellipsis">doc.rust-lang.org/std/primitiv</span><span class="invisible">e.slice.html#method.split_at_mut</span></a></p><p><a href="https://floss.social/tags/Rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Rust</span></a> <a href="https://floss.social/tags/RustLang" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>RustLang</span></a> <a href="https://floss.social/tags/SplitBorrows" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>SplitBorrows</span></a> <a href="https://floss.social/tags/BorrowChk" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BorrowChk</span></a></p>