Skip to content

goodsw4all/to-be-rustacean

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Rust as a embedded C programmer

Intro

C 에서 Rust 로 main 언어로 사용하기 위한 여정: My journey to be a Rustacean 🦀

Good reasons for C Programmers

  • one-stop package & build system
  • test built-in support, easy TDD
  • memory safe coding
  • compiler driven development
  • dev community
  • documentations
  • modern programming concepts
  • wide range from embedded to web

Basic concepts

  • statements and expressions
    • statements
      • serve mostly to contain and explicitly sequence expression evaluation : does not return, followed by ;
        • declaration statements
        • expression statements
    • expressions
      • it always produces a value, and it may have effects : returns a value
      • evaluates to a value, and has effects during evaluation
  • ownership
    • the main purpose of ownership is to manage heap data
    • rules
    • Each value in Rust has an owner.
    • There can only be one owner at a time.
    • When the owner goes out of scope, the value will be dropped.
  • reference
    • like a pointer in that it’s an address we can follow to access the data stored at that address
    • rules
      • 1 mutable reference or N immutable references.
      • always be valid.
  • borrowing
    • the action of creating a reference
    • borrow checker
      • compares scopes to determine whether all borrows are valid
  • enum
    • give you a way of saying a value is one of a possible set of values
    • can have associated values
  • pattern matching
    • patterns : Literals, Destructured arrays, enums, structs, or tuples, variables, wildcards, placeholders
    • matching : compare it to some value. If the pattern matches, use the value parts in our code
  • generics
    • abstract stand-ins for concrete types or other properties
      • concrete type (i32, f32, String ...)
      • generic types
        • Option
        • Result<T, E>
        • Vec
        • HashMap<K, V>
    • monomorphization
      • turning generic code into specific code by filling in the concrete types that are used when compiled
  • trait
    • defines functionality a particular type has and can share with other types (shared behavier, like interface)
  • lifetime
    • another kind of generic
    • ensure that references are valid as long as we need them to be
  • functional programming
    • style
      • using functions as values by passing them in arguments,
        returning them from other functions, assigning them to variables for later execution
    • closure
      • a function-like construct you can store in a variable
    • iterator
      • a way of processing a series of elements
  • smart pointers
    • pointer
      • general concept for a variable that contains an address in memory
    • smart pointer
      • data structures that act like a pointer but also have additional metadata and capabilities
    • deref coercion
      • converts a reference to a type that implements the Deref trait into a reference to another type
    • Interior mutability
      • a mutable borrow to an immutable value
    • common smart pointers
      • Box for allocating values on the heap
      • Rc, a reference counting type that enables multiple ownership
      • Ref, RefMut, accessed through RefCell,
        a type that enforces the borrowing rules at runtime instead of compile time

Learning

Step 1 : Rust fundamental (syntax & idioms)

Step 2 : Coding Practice

muscle memory building(actually it doensnt have memory though)
어느 정도 코딩할 수 있을 정도 지식이 생기면, 코딩 하면서 부족한 부분을 명확히 인지하게 되고 그 부분을 관련 자료 찾아 공부

  • Rustlings : 조금 쉬운 편 (22.05.20) https://github.com/rust-lang/rustlings Rustlings Completed

  • Exercism : Online learning how to coding platform (코딩 인터뷰용이라기 보단, 교육적 목적 for free)
    https://exercism.org/tracks/rust
    Solve coding exercises and get mentored to gain true fluency in your chosen programming languages.
    Web에서 문제를 풀어볼 수 있지만, WORK LOCALLY 방식으로 IDE의 도움받아서 코딩하는 것이 좋고, Test Case를 통해 힌트를 얻고 test 작성법을 배울 수 있다.

    Exercsim Status

  • Coding Quiz(Leetcode 류의 문제) : 연습량 늘리기 /practice/training/

Step 3 : Rust intermediate

Zero 2 Production in RUST

  • Actix 로 Back-end 만드는 과정, 최근에 Update 되었고, 책을 쓴 이유 중 하나가 새로 오는 팀원들을 위해 썼다고 한다. 그래서, 초보용 책은 아니지만, 세심하게 배려했다고 서문과 리뷰에 언급되어 있어 안심하고 구매(했지만, 어렵다.)

Step 4 : Learning by doing some projects

useful, big idea, start small 만들자 무언가 (생각나는 대로 적어 보고, 점차 구체화 할 것)

My own q/a

References

syntax

About

My journey to become a rustacean

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published