Jan :rust: :ferris:<p><span class="h-card" translate="no"><a href="https://genomic.social/@kloetzl" class="u-url mention" rel="nofollow noopener" target="_blank">@<span>kloetzl</span></a></span> You can use a concept called "Borrow Splitting" in combination with scoped threads.</p><p>This way, your slices that your threads operate on, can have a lifetime shorter than 'static and you don't need to use <a href="https://floss.social/tags/unsafe" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>unsafe</span></a> shenanigans. :ferris: </p><p>Please see this playground with comments on how to do this:<br><a href="https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=6b028d5bab84d739d34d76d66a750578" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">play.rust-lang.org/?version=st</span><span class="invisible">able&mode=debug&edition=2024&gist=6b028d5bab84d739d34d76d66a750578</span></a></p><p>On Borrrow Splitting:<br><a href="https://doc.rust-lang.org/nomicon/borrow-splitting.html" rel="nofollow noopener" translate="no" 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>On scoped threads API:<br><a href="https://doc.rust-lang.org/std/thread/fn.scope.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">doc.rust-lang.org/std/thread/f</span><span class="invisible">n.scope.html</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> <a href="https://floss.social/tags/Concurrency" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Concurrency</span></a> <a href="https://floss.social/tags/Threads" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Threads</span></a></p>