Skip to content
tezvyn:

Rust

190 bites tagged Rust — interview questions with model answers, and 60-second explainers.

Go & Rust2 min read

Cancellation and cleanup: Go context/errgroup vs Tokio

Go propagates cancellation via context.Context that goroutines must poll, with errgroup canceling siblings on first error; Tokio cancels by dropping futures, which stops them at await… structured-concurrency cancellation knowledge.

Go & Rust2 min read

Implicit Go interfaces versus explicit Rust trait impls

Go's implicit satisfaction enables decoupling and retrofitting but hides who implements what and risks accidental conformance; Rust's explicit impls aid discovery, refactoring… understanding of conformance models and maintainability.

Go & Rust2 min read

anyhow versus thiserror in Rust error handling

Anyhow gives one opaque dynamic error type for applications where you mostly propagate and report; thiserror derives concrete typed enums for libraries so callers can match on variants. idiomatic error-design judgment.

Go & Rust2 min read

Go if err != nil versus Rust's ? operator

Go's explicit checks are verbose but make every error site visible; Rust's ? propagates concisely while still forcing the error into the type, reducing boilerplate. judgment on error-handling ergonomics.

Go & Rust2 min read

Designing a logging abstraction: Go interfaces vs Rust traits

Define a Logger interface/trait with a write method; Go interfaces are always dynamically dispatched; Rust lets you choose static dispatch (impl Trait/generics) or… ability to design polymorphic abstractions and explain dispatch.

Go & Rust2 min read

Go slices versus Rust Vec growth and reallocation

Both are a (pointer, length, capacity) triple over a heap buffer that reallocates and copies on growth, roughly doubling; key difference is Go slices share backing arrays and have no ownership… understanding of dynamic-array internals.

Go & Rust1 min read

Go interfaces versus Rust traits and macros at scale

Go uses reflection over interface{} (e.g. encoding/json) for runtime flexibility; Rust uses traits plus derive/proc macros (e.g. serde) for compile-time, zero-cost code generation. connecting language philosophy to ecosystem patterns.

Go & Rust2 min read

Go's mandatory runtime versus Rust's minimal runtime

Go ships a GC and goroutine scheduler in every binary, ideal for services; Rust has only a tiny runtime and no GC, enabling embedded, kernels, and WASM. understanding of runtime cost and its limits.

Go & Rust1 min read

Go interface-constraint generics versus Rust trait bounds

Go constrains type parameters with interfaces and may use dictionaries/shape stenciling; Rust uses trait bounds with full monomorphization for zero-cost specialization. understanding of generics design and monomorphization.

Go & Rust2 min read

Go (T, error) versus Rust Result for error handling

Go returns a separate error value you may ignore; Rust wraps success or error in one Result enum the compiler forces you to handle. Go favors simplicity, Rust favors compile-enforced safety. understanding of explicit error models.

Go & Rust1 min read

Goroutines and channels versus ownership-based concurrency

Go uses cheap goroutines and CSP-style channels to coordinate by communication; Rust uses ownership plus Send/Sync to make data races a compile error. understanding of two concurrency philosophies.

Go & Rust1 min read

Structural Go interfaces versus nominal Rust traits

Go interfaces are satisfied implicitly by method shape (structural); Rust traits must be explicitly implemented (nominal). grasp of typing models and their design impact.

Go & Rust1 min read

Criterion: the standard Rust benchmarking library

Criterion runs on stable Rust, collects many samples, applies statistical analysis with confidence intervals, and compares against saved baselines to detect regressions. ecosystem awareness and rigor about measurement.

Go & Rust2 min read

Rust lifetimes versus Go garbage-collected lifetimes

A lifetime is a compile-time region a reference is valid for; annotations like 'a relate input and output reference durations; Go instead uses garbage collection and escape analysis. understanding of how Rust tracks reference validity.

Go & Rust1 min read

Fearless concurrency: Rust compile-time vs Go runtime

Rust uses ownership plus Send/Sync to reject data races at compile time; Go encourages channels but still allows races, with the runtime race detector catching them at test… understanding of where each language catches concurrency bugs.

Go & Rust2 min read

Why Pin is needed for self-referential Futures

Async blocks compile to state machines that can hold references into their own storage; Pin guarantees the value will not move so those internal pointers stay valid across polls. deep grasp of async internals.

Go & Rust1 min read

Architecting an L7 proxy in Go versus Rust

Go offers GC and cheap goroutines for fast delivery but tail-latency GC pauses; Rust offers ownership and async/await for predictable latency at higher complexity. ability to weigh systems trade-offs under real constraints.

Go & Rust1 min read

Rust Send and Sync marker traits explained

Send means a value can move across threads, Sync means a reference can be shared; Rc uses non-atomic refcounts, Arc uses atomic ones. understanding of compile-time thread-safety guarantees. confusing the two traits.

Go & Rust2 min read

Static dispatch over Write with generics in Rust

Write generically over the std::io::Write trait with a type parameter W: Write, letting the compiler monomorphize and inline per concrete type, avoiding the vtable indirection of Box<dyn Write>. static vs dynamic dispatch trade-offs.

Go & Rust2 min read

Handling Result and errors in a Rust web handler

Handler returns Result, the ? operator early-returns errors, a custom error type implements IntoResponse to map to 500, success returns 200 with data. Result-based error handling in web handlers.

Go & Rust2 min read

Building a safe Rust wrapper over an unsafe C API

Hide extern calls behind a safe module, own the resource in a struct with Drop calling the C free, return Result mapping C error codes, use NewType/NonNull and PhantomData. FFI encapsulation patterns.

Go & Rust2 min read

Passing Go/Rust callbacks to a C library

C needs a plain function pointer; in Go use //export with cgo, in Rust an extern "C" fn; carry state via a void* user-data param. FFI callback mechanics.

Go & Rust1 min read

Rust references vs raw pointers

References are borrow-checked, always valid, aliasing-controlled, non-null; raw pointers carry no guarantees, can be null, dangling, or aliased, and dereferencing needs unsafe. safety invariants of references.

Go & Rust1 min read

Profiling a Rust hot loop with perf

Build with debuginfo, perf record cycles or cache-misses, perf report then perf annotate to map counters to source/asm; flamegraph for hotspots. low-level performance profiling.

Get Rust bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.