home.social

#splitborrows — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #splitborrows, aggregated by home.social.

  1. @wtfrank You can use a concept called "Split Borrows" or "Borrow Splitting":

    doc.rust-lang.org/nomicon/borr

    Here is a playground that shows it:
    play.rust-lang.org/?version=st

    It boils down to the following:
    You can split your vector (or rather slice) into two mutable parts and mutate each half individually, by using `split_at_mut` on slices:

    See docs in std:
    doc.rust-lang.org/std/primitiv

    #Rust #RustLang #SplitBorrows #BorrowChk