Learning about "take" with a Linked List example | Rust Language

āđāļŠāļĢāđŒ
āļāļąāļ‡
  • āđ€āļœāļĒāđāļžāļĢāđˆāđ€āļĄāļ·āđˆāļ­ 15 āđ€āļĄ.āļĒ. 2024
  • I share Some of the things I learned from studying how to do a Linked List in Rust, especially using the "take()" method. The idea was to learn how to manipulate the structs and struct data contained within the Nodes of the Linked List. In summary, this was to practice using Box, Option, and Generic type T as much as possible. Note I think of "next" as "previous" mainly due to learning about the Bitcoin nettwork which uses "previous blockhash" - my bad!
    Rust Docs:
    doc.rust-lang.org/std/option/...
    Rust Playground example:
    play.rust-lang.org/?version=s...
    Here are some notes on the "length" function that checks how many nodes are in the list :
    github.com/RGGH/lx/blob/main/...
    Linux Hosting - VPS server - Webdock
    ----------------------------------------------------------------
    ðŸŸĐ Webdock Linux Hosting : webdock.io/en?maff=wdaff--170
    Nostr
    ---------
    @RngWeb
    findthatbit@iris.to
    findthatbit.info/
    redandgreen.co.uk/
    #rustlang #linkedlist #learningrust

āļ„āļ§āļēāļĄāļ„āļīāļ”āđ€āļŦāđ‡āļ™ • 2

  • @Heater-v1.0.0
    @Heater-v1.0.0 āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™ +1

    Since the dawn of time the pointer to the next node in a linked list has been called "next". No confusion there.

    • @learning_rust
      @learning_rust  āļŦāļĨāļēāļĒāđ€āļ”āļ·āļ­āļ™āļāđˆāļ­āļ™

      Thank you.
      I think maybe I've been tinkering with Bitcoin nodes too much, where there is a "previous block"