Code Explainers

Code explainers tagged #ownership

rust
use std::time::Duration;
 
#[derive(Debug, Clone)]
pub struct ServerConfig {

The builder pattern in Rust

builder-pattern ownership error-handling
Intermediate 8 steps
rust
use std::fs::{File, OpenOptions};
use std::io::{self, Write};
use std::path::Path;
 

A buffered log writer in Rust

buffering raii file-io
Intermediate 9 steps
rust
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::thread;
 

Aggregating metrics across threads in Rust

concurrency shared-state mutex
Intermediate 7 steps
rust
use std::sync::{mpsc, Arc, Mutex};
use std::thread;
use std::time::Duration;
 

Building a thread pool in Rust

concurrency channels thread-pool
Advanced 9 steps
rust
use std::collections::HashMap;
 
#[derive(Debug, Clone)]
struct Order {

Aggregating Rust data with fold and entry

fold hashmap ownership
Intermediate 6 steps