Skip to content

#rust

83 posts tagged rust. All posts

  1. RustCargo basics: creating Rust projects and managing dependenciesCreate a Rust project with Cargo, add crates with cargo add, understand Cargo.toml version requirements and Cargo.lock, and the commands you use daily.
  2. RustConcurrency and parallelism in Rust: threads, channels, atomics, locks and RayonWorking examples of Rust's standard concurrency tools (threads, scoped threads, channels, atomics, Mutex, RwLock) and data parallelism with Rayon.
  3. RustWriting generic Rust code with traits and trait boundsDefine a Rust trait, implement it for your own types, and write generic functions with trait bounds, impl Trait, where clauses and dyn Trait.
  4. RustWebAssembly for serverless functions: why it fits and a first Spin appWhy WebAssembly suits serverless functions, which platforms run it (Fastly Compute, Cloudflare Workers, Spin), and how to build a Rust HTTP function with Spin.
  5. RustWebAssembly for browser games: engines, toolchains and gotchasWhich engines and toolchains can ship a game to the browser as WebAssembly, a minimal Emscripten game loop, and the problems you hit when you deploy it.
  6. RustRust data structures: tuples, arrays, slices, std collections, structs and enumsA tour of Rust's core data structures, from tuples, arrays and slices to Vec, String, HashMap and HashSet, plus custom structs and enums.
  7. RustCalling WebAssembly from JavaScript: exports, imports and when it is fasterHow to load a .wasm module in the browser, call its exports, pass JavaScript functions in as imports, and decide whether moving code to WebAssembly will help.
  8. RustCalling C functions from Rust with FFI and the cc crateCompile a small C file with a Cargo build script, declare it in an unsafe extern block, and call it from Rust, including passing strings with CString.
  9. RustWrite a procedural macro in Rust: a custom assert_equals! with syn and quoteBuild a function-like procedural macro that compares two expressions and prints both values on failure, and compare it with a macro_rules! version.
  10. Rustserde_json basics: converting Rust structs to and from JSONAdd serde and serde_json to a Rust project, derive Serialize and Deserialize, and convert structs to and from JSON strings with error handling.
  11. RustUnsafe Rust basics: raw pointers and calling C's malloc and freeWhat the unsafe keyword allows in Rust, with two examples, dereferencing a raw pointer and managing a buffer with libc's malloc and free, plus the rules you must uphold.
  12. RustRust and other languages: FFI, WebAssembly, and gRPC comparedThree ways to make Rust work with other languages: in-process calls over the C ABI, compiling to WebAssembly, and gRPC services over the network.
  13. RustCalling C and C++ code from Rust with FFI and the cc crateCompile C and C++ sources with the cc crate, declare them in Rust with extern "C", pass strings safely with CString, and wrap C++ classes in C functions.
  14. RustSharing data between threads in Rust with Arc and MutexUse Arc<Mutex<T>> to let several threads update one Vec safely, plus when an atomic or a channel is the better synchronization primitive.
  15. RustBuilding a TCP chat server and client in Rust with std::netA small multi-client chat program using only Rust's standard library: TcpListener, one thread per client, and a shared map of connections for broadcasting.
  16. RustGetting started with Rocket 0.5: routes, catchers and Tera templatesSet up a Rocket 0.5 web app in Rust on stable: define routes, add a custom 404 catcher, and render HTML with rocket_dyn_templates and Tera.
  17. RustHashing strings with SHA-256 and SHA-512 in Rust using the sha2 crateA small Rust program that reads a line from stdin and prints its SHA-256 and SHA-512 digests as hex, using the RustCrypto sha2 and hex crates.
  18. RustBuild a command-line weather app in Rust with reqwest and OpenWeatherMapA small Rust CLI that looks up current weather by city name from the OpenWeatherMap API, using reqwest's blocking client and serde for JSON.
  19. RustReading and writing CSV files in C++ with ifstream and ofstreamRead a CSV file line by line in C++, split fields correctly (including quoted commas), add a computed column and write the result to a new file.
  20. RustReading, filtering, sorting and writing CSV files in RustUse the csv and serde crates to read a CSV file into Rust structs, filter and sort the rows, and write the result to a new CSV file.
  21. RustEstimating pi with threads in Rust using the Monte Carlo methodSplit a Monte Carlo estimate of pi across std::thread workers, collect results through JoinHandle, and compare with sharing state via Arc and Mutex.
  22. RustCounting words in Rust with HashMap, HashSet and BTreeMapBuild a word-frequency counter in Rust with HashMap's entry API, find unique words with HashSet, and get sorted output with BTreeMap or a sorted Vec.
  23. RustRust borrowing rules by example: averaging a Vec through a shared referenceA small Rust program that reads integers from stdin and averages them through a borrowed slice, showing shared and mutable borrows and the compile error you get when they overlap.
  24. RustRust lifetimes: why a struct can't borrow from its own fieldRust lifetimes through one example: a struct holding strings and references to them, why it won't compile, and two designs that do.
  25. RustRust memory management: ownership, borrowing and smart pointersHow Rust frees memory without a garbage collector: ownership and moves, borrowing rules, Box, Rc, Arc, Cell and RefCell, with runnable examples.
  26. RustComputer vision in Rust: Canny edge detection with the opencv crateInstall OpenCV and the opencv crate, load an image, and run Gaussian blur and Canny edge detection from Rust, with notes on how the bindings map OpenCV's API.
  27. RustBenchmarking Rust code with Criterion.rsSet up Criterion.rs to benchmark Rust code on stable: a first benchmark, parameterised inputs, throughput, baselines and HTML reports.
  28. RustUsing Rust's type system to catch bugs: newtypes, enums and traitsThree Rust type-system techniques that turn runtime bugs into compile errors: newtypes for units, enums for errors, and traits for shared behaviour.
  29. RustRust match expressions: destructuring, guards, ranges, @ bindings and or-patternsHow Rust's match works: exhaustiveness checking, destructuring enums, match guards, range patterns, @ bindings and or-patterns, with runnable examples.
  30. RustArbitrary-precision integers in Rust with num-bigintHow to create, parse, compare and do arithmetic on arbitrarily large integers in Rust with num-bigint's BigInt and BigUint types.
  31. RustCargo basics: building, testing, packaging and cross-compiling Rust appsThe Cargo commands you use day to day: create a project, add dependencies, build debug and release binaries, run tests, publish to crates.io and cross-compile.
  32. RustRust text processing: String, &str and the regex crateHow Rust's String and &str differ, the standard methods for building and splitting text, why len() counts bytes, and matching with the regex crate.
  33. RustWeb scraping in Rust with reqwest and scraperFetch a page with reqwest, pull out elements with CSS selectors using the scraper crate, and write the results to a file, using Hacker News as the example.
  34. RustUnsafe Rust basics: raw pointers, unsafe traits, and calling CWhat `unsafe` actually allows in Rust, how unsafe functions and traits differ, how to wrap unsafe code in a safe API, and how to call a C function over FFI.
  35. RustBuilding a du-style directory size tool in Rust with clap, walkdir and humansizeA small Rust CLI that adds up the size of every file under a directory, with an optional depth limit, using clap, walkdir and humansize.
  36. RustBuilding a web app in Rust with Actix Web (routing, logging, Postgres and templates)Build an Actix Web 4 app step by step, with path parameters, request logging, inserting rows into Postgres with sqlx, Tera templates and static files.
  37. RustFetching Pokémon data from PokeAPI in Rust with reqwest and serdeBuild a small Rust CLI that looks up a Pokémon on PokeAPI, deserializes the JSON with serde, and prints its height, weight, and types.
  38. RustRust iterators: adapters, consumers, and writing your ownHow Rust's Iterator trait works, how lazy adapters like map and filter chain into consumers like sum, how to implement a custom iterator, and common pitfalls.
  39. RustBuilding a colored line diff CLI in Rust with clap and similarBuild a small diff-like command-line tool in Rust that compares two text files line by line and prints insertions and deletions in color.
  40. RustBuilding a command-line to-do list in RustBuild an interactive to-do list in Rust with only the standard library: reading commands from stdin, matching on them, and editing a Vec of tasks.
  41. RustOpenGMK: building the Rust GameMaker Classic runner, TAS tools and decompilerOpenGMK is a Rust rewrite of the GameMaker Classic (GM8) runner with TAS tooling and a decompiler. How to build it from source and run, record and decompile games.
  42. RustRendering SVG to PNG in Rust with resvgHow to parse an SVG with usvg, render it with resvg into a tiny-skia pixmap, scale the output, and save it as a PNG using the current resvg API.
  43. RustMongoDB CRUD in Rust with the official mongodb driverConnect to MongoDB from Rust with the official mongodb 3.x driver, map documents to serde structs, and insert, find, update and delete them.
  44. RustUsing TerminusDB from Rust with reqwest and the HTTP APIRun TerminusDB in Docker, then create a database, add a schema, insert documents and read them back from Rust using reqwest and serde_json.
  45. RustHow Rust's compiler helps you build reliable programs (and where it can't)Rust features that remove whole classes of bugs: ownership and borrowing, Result and Option, exhaustive match, and thread-safe sharing, plus what Rust doesn't prevent.
  46. RustWorking with Option and Result in Rust: matching, combinators and conversionsUse Rust's Option and Result types with match, combinators such as map, and_then and unwrap_or, the ? operator, and conversions like ok_or and transpose.
  47. RustRegular expressions in Rust with the regex crateMatch, find, capture and replace text in Rust with the regex crate, plus what its syntax leaves out compared with PCRE and how to compile a pattern once.
  48. RustProfiling Rust code with perf, Criterion and cargo-flamegraphHow to find slow code in a Rust program: sample it with perf, draw a flamegraph with cargo-flamegraph, and measure changes with Criterion benchmarks.
  49. RustRegular expressions in Rust: matching, capturing and replacing with the regex crateHow to compile, match, capture and replace with Rust's regex crate, compile patterns once with LazyLock, and when to reach for fancy-regex.
  50. RustFinding and using third-party Rust crates with CargoHow to find Rust crates on crates.io, add them with cargo add, choose versions and features, and call an async HTTP client (reqwest with tokio).
  51. RustGenerating UUIDs in Rust with the uuid crateHow to generate random (v4), name-based (v5) and time-ordered (v7) UUIDs in Rust with the uuid crate, including the Cargo features each one needs.
  52. RustHello world HTTP server with hyper 1.x in RustBuild a minimal async HTTP/1 server with hyper 1.x, hyper-util and Tokio, and see what changed from the hyper 0.14 Server API.
  53. RustCalling shared libraries from Rust: link-time vs runtime loadingHow Rust calls functions in a C shared library, either linked when the program starts or loaded at runtime with libloading or dlopen.
  54. RustEmail slicer in Rust: splitting an address into username and domainA small Rust exercise that splits an email address into its username and domain, first with a character loop and then with split_once.
  55. RustResize, rotate and adjust brightness of images in Rust with the image crateBuild a small Rust library with the image and imageproc crates that loads, resizes, rotates, brightens and adjusts the contrast of images, then saves the results.
  56. RustBuild a JSON API in Rust with Rocket 0.5 and connect it to PostgreSQL with DieselCreate a small Rocket 0.5 web server with JSON GET and POST routes, then open a PostgreSQL connection with Diesel 2 and dotenvy.
  57. RustBatch renaming files with regex in RustBuild a small Rust CLI with clap and the regex crate that renames every file in a directory using a regex pattern and replacement, with a dry-run mode.
  58. RustError handling in Rust: Result, the ? operator and custom error typesHow Rust handles errors with Result and panic!, how to propagate errors with ?, and how to define a custom error type that wraps other errors.
  59. RustWebAssembly in desktop apps: a Rust module in a Tauri windowWhere WebAssembly fits in a cross-platform desktop app, and how to compile a Rust function to Wasm with wasm-bindgen and call it from a Tauri 2 frontend.
  60. RustTechnical analysis in Rust: SMA and EMA from Alpha Vantage pricesFetch daily stock prices from the Alpha Vantage API with reqwest and serde, then calculate simple and exponential moving averages in Rust.
  61. RustWriting WebAssembly smart contracts in Rust: a NEAR key-value storeWhich blockchains run WebAssembly smart contracts, and how to write, build and deploy a small Rust key-value contract on NEAR.
  62. RustLogging in Rust with the log crate and env_loggerAdd logging to a Rust program with the log facade and env_logger, use the five log levels, and control output with the RUST_LOG variable.
  63. AI & dataHow AI could change software development, and where it falls shortA May 2023 view of where AI could help across the software lifecycle (coding, requirements, testing, deployment) and why human engineers remain essential.
  64. RustQuerying, starting and stopping Windows services from Rust with the Windows APICall the Service Control Manager (OpenSCManagerW, OpenServiceW, QueryServiceStatus, StartServiceW, ControlService) from Rust using the windows-sys crate.
  65. RustCreating and terminating Windows processes from Rust with winapiCall CreateProcessW, TerminateProcess and WaitForSingleObject from Rust with the winapi crate, plus the equivalent code using Microsoft's windows-sys crate.
  66. RustRead and write Windows clipboard text from Rust with WinAPICopy and paste Unicode text through the Win32 clipboard API in Rust: OpenClipboard, GlobalAlloc, SetClipboardData and GetClipboardData, with correct error handling.
  67. RustReading and writing files with the Windows API in Rust (CreateFileW, ReadFile, WriteFile)Create, write, and read a file in Rust by calling CreateFileW, WriteFile, and ReadFile through windows-sys, with correct error handling.
  68. RustReading and writing the Windows Registry from Rust with the winapi crateCreate, open, read, write and delete Windows Registry keys and values from Rust using raw Win32 calls through the winapi crate, with correct error handling.
  69. RustCreate a basic Win32 window in Rust with the winapi crateRegister a window class, create a window and run a message loop using raw Win32 calls from Rust, with notes on the maintained windows-sys crate.
  70. RustHashbrown in Rust: what it adds over std HashMap and where the speed comes fromstd's HashMap is already built on hashbrown. Here is what the crate still offers (no_std, a faster default hasher) and how to benchmark it fairly.
  71. RustCompiling and calling C code from Rust with the cc crateUse a build.rs script and the cc crate to compile C files into a static library, link it into a Rust crate, and call the functions through extern blocks.
  72. RustHexadecimal in Rust: literals, formatting, parsing and the hex crateWrite hex literals, format integers as hex with {:x} and {:#X}, parse hex strings with from_str_radix, and encode or decode bytes with the hex crate.
  73. RustGetting started with the tracing crate in Rust: spans, events and tokio-consoleAdd structured spans and events to a Rust program with tracing and tracing-subscriber, time spans, and inspect async tasks with tokio-console.
  74. RustFaster hash maps in Rust with rustc-hash (FxHashMap)Swap std's SipHash-based HashMap for rustc-hash's FxHashMap, benchmark the two with Criterion, and know when the faster non-DoS-resistant hasher is a bad idea.
  75. RustGenerator functions in Rust: iter::from_fn, async-stream and nightly gen blocksRust has no stable yield keyword. Here's how to write generator-style code today with iter::from_fn, async-stream, and the unstable gen blocks.
  76. RustDownloading videos with yaydl and driving it from a Rust programInstall the yaydl video downloader, use its command-line options, and call it from Rust with std::process::Command, since it has no library API.
  77. RustFormatting Rust code with rustfmt and cargo fmtInstall rustfmt, run cargo fmt locally and in CI, configure it with rustfmt.toml, and set up format-on-save in your editor.
  78. RustBuilding a Discord ping bot in Rust with SerenityWrite a minimal Discord bot in Rust with Serenity 0.12 that answers !ping, including gateway intents, the bot token and inviting it to a server.
  79. RustWriting simple cat, wc and ls clones in RustBuild minimal versions of the cat, wc and ls coreutils in Rust using only the standard library, and see how uutils does it for real.
  80. RustA TLS server and client in Rust with rustls and tokio-rustlsBuild a small TLS echo server and client in Rust with rustls 0.23 and tokio-rustls, loading PEM certificates and trusting a local CA.
  81. RustOptimizing PNG files from Rust with the oxipng crateUse oxipng as a Rust library to losslessly shrink PNG files on disk or in memory, and tune its presets, filters, metadata stripping and Zopfli.
  82. RustConnecting to MySQL from Rust with the mysql crateUse the synchronous mysql crate to open a connection pool, create a table, insert rows with parameterised queries and map results into Rust structs.
  83. RustDates and times in Rust with the chrono crateCreate, parse, format and do arithmetic on dates and times with chrono, using the non-deprecated constructors and calendar-aware month math.

© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)