`with(x) { ... }` is `run` flipped: the receiver is the first argument. Reads naturally when you're doing several things to an existing object without chaining.
Most databases don't have a real `PIVOT` keyword (SQL Server does). The portable answer is conditional aggregation — `SUM(CASE WHEN ...) AS col` for each pivoted value.
`encoding/base64` has Standard, URL-safe, and Raw (no padding) variants. URL-safe replaces `+/` with `-_` so the output is safe in query strings and filenames.
Implement `From` and you get `Into` for free. Then `.into()` and `T::from(x)` both work. The single most idiomatic way to express type conversions in Rust.
`async fn` returns a future; `.await` drives it. tokio is the de-facto runtime. The `#[tokio::main]` attribute turns `main` into the runtime entry point.
Wrap a blocking function so it doesn't freeze the event loop. asyncio.to_thread (3.9+) schedules the call onto the default executor and awaits the result.
`List<*>` means "list of something I don't need to know exactly" — read-only with Any? as element type. Useful when you genuinely don't care about the parameter.
Return the first or last value within a window. Useful for "compare each row to the partition's first/last value" — for example, "how much have we grown since the user's first order?"
Lock-free atomics for shared counters. `AtomicInteger` for low contention; `LongAdder` for high contention (shards internally — much faster under heavy parallel load).
Stitch a stream of events into "sessions" where events more than N minutes apart start a new session. Uses LAG + a SUM-OVER trick to assign session IDs.