Code Monkey home page Code Monkey logo

Comments (2)

simonsan avatar simonsan commented on May 26, 2024

Would be nice if we could collect some ideas of which topics/quirks to cover or, in general, what would be a reasonable approach to the overall topic of borrow checker patterns.

from patterns.

Owen-CH-Leung avatar Owen-CH-Leung commented on May 26, 2024

I feel like to fully understand borrow & checker, we should cover the following topics :

  • Explanation of Borrowing Rules: While Rust's borrowing rules are documented, it would be helpful to have more in-depth explanations and examples that show these rules in action.

  • Common Borrow Checker Errors: A guide to common borrow checker errors, their causes, and how to resolve them could be very helpful for new Rust developers.

  • Borrowing in Different Contexts: Borrowing behaves differently in different contexts (e.g., in struct fields, in loops, in closures). Each of these could be a topic of its own.

  • Patterns for Avoiding Borrow Checker Errors: Some coding patterns can help avoid borrow checker errors. For example, splitting functions, using Rc and RefCell for shared ownership, or using the Cow type for efficient cloning.

  • Understanding Lifetimes: Lifetimes are a crucial part of the borrow checker, but they can be confusing for newcomers. More resources on understanding and using lifetimes could be very valuable.

  • Move semantics: Lastly, we should also provide some materials with regard to the concept of move. Speak of this, I found rustlings exercise on move semantics very useful.

https://github.com/rust-lang/rustlings/tree/main/exercises/move_semantics

@simonsan What's your thoughts on this ?

from patterns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.