Skip to content

Instantly share code, notes, and snippets.

@jacobmoyle
Created December 6, 2024 19:42
Show Gist options
  • Select an option

  • Save jacobmoyle/28e5283da020fbcf20ef5f9fa0cb8e16 to your computer and use it in GitHub Desktop.

Select an option

Save jacobmoyle/28e5283da020fbcf20ef5f9fa0cb8e16 to your computer and use it in GitHub Desktop.
Rust Setup Guide | Macbook-2021 OS v15.1.1

What is this?

This gist is a formatted collection of personal notes taken during local Rust setup on a macbook laptop in preperation for "The Book".

Who is this for?

This is written for Jacob (the author) to look back on and question his own decisions. Follow at your own risk.

Table of Contents

Setup

This was all written with 3.5 hours of sleep. Good luck.

Install rust and cargo

Install Rust + cargo + fun bits using rustup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Install a method to write rust

Install an editor of choice that has LSP support for autocompletion and more--recommended:

Install rust-analyzer to your IDE.

(Optional) Install a sandbox to experiment

Install the evcxr repl:

cargo install --locked evcxr_repl

Now you can code in your terminal using a poorly named project:

> evcxr
Welcome to evcxr. For help, type :help
>> println!("hello world")
hello world
()
>> :quit

(Optional) Install a background rust compiler

Think nodemon, or entr. Use bacon or watchexec, I chose bacon.

bacon is a background code checker.

It's designed for minimal interaction so that you can just let it run, alongside your editor, and be notified of warnings, errors, or test failures in your Rust code.

cargo install --locked bacon

(Optional) Learn rust

  • Lightly skim "The Book" once
  • Work through Rustlings as you read "The Book" a second time, more in depth

(Optional) Review some popular rust libraries

  • Tokio - A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language.
  • Tracing - A framework for instrumenting Rust programs to collect structured, event-based diagnostic information.
  • reqwest - An ergonomic, batteries-included HTTP Client for Rust.
  • Rayon - A data-parallelism library for Rust.
  • AWS SDK - AWS SDK with initial emphasis on S3.
  • clap - A command line argument parser.
  • sqlx - An async, pure Rust SQL crate featuring compile-time checked queries without a DSL.
  • chrono - Aims to provide all functionality needed to do correct operations on dates and times in the proleptic Gregorian calendar.
  • egui - A simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, natively, and in your favorite game engine.
  • Yew - A modern Rust framework for creating multi-threaded front-end web apps with WebAssembly.
  • clippy - A collection of lints to catch common mistakes and improve your Rust code.

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment