Coder Social home page Coder Social logo

rust-crud's Introduction

RS-CRUD

GOALS

  1. Create a CRUD application to be familiar with Rust.
  2. Use various features even it's not necessary, just for an educational purpose.
  3. CRUD of a simple entity: User
  4. CRUD of a simple entity: Post

Processes

  1. 08/19/2023: Connect to database(mysql), add GET user api
  2. 08/20/2023: Fix compile errors in 1, Add POST, DELETE, PUT user api
  3. 08/26/2023: CRUD of Post entity
  4. 09/02/2023: Exception handling + middlewares - best practices
  5. 09/17/2023: Dockerization
  6. 09/23/2023: Refactoring - divide into modules

TODOS

  1. Exception handling
  2. ADD middlewares
  3. Refactoring - divide dependencies into modules
  4. Unit Tests
  5. Use multithreading + async/await even it's not necessary
  6. Add hot reload
  7. Add auth
  8. Db connection pooling - already did it
  9. Add Dockerization

Lesson Points

Closure - function-like construct that can capture its surrounding environment.

Closures are similar to lambdas or anonymous functions in other programming languages.

Closures in Rust have a unique feature: they can capture their environment in three ways: by reference, by mutable reference, or by value

You can use move keyword before the parameter list to force the closure to take ownership of the values it uses in the environment.

Especially in concurrency programming, you can use move keyword to transfer ownership of the values to the closure so that the closure can be executed in another thread.

use std::thread;

let message = "Hello from a thread!".to_string();

thread::spawn(move || {
    println!("{}", message);
}).join().unwrap();

rust-crud's People

Contributors

sejin-p avatar

Watchers

 avatar  avatar

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.