Thema: rust
-
Go oder Rust für einen neuen Dienst wählen: ein Entscheidungsverfahren ohne Benchmarks
Die Wahl zwischen Go und Rust für einen Dienst anhand dokumentierter Spracheigenschaften und Teambeschränkungen treffen statt anhand von Benchmark-Folklore: Speicherverwaltungsmodell, Fehler- und Nebenläufigkeitsstil, Form der Arbeitslast, die Bibliotheken, mit denen der Dienst sprechen muss, und wer ihn in zwei Jahren pflegen wird.
-
Cargo, Crates und Editions: wie ein Rust-Projekt gebaut und versioniert wird
Cargo baut ein Crate aus Cargo.toml, löst Abhängigkeiten mit SemVer-kompatiblen Bereichen in Cargo.lock auf und kann zwei inkompatible Hauptversionen desselben Crates in einem einzigen Build enthalten. Editions sind pro Crate wählbare Sprachversionen, die zusammenarbeiten, sodass das Anheben der Edition eines Crates dessen abhängige Crates nie zum Mitziehen zwingt.
-
Rust Ownership und Borrowing im Überblick
Jeder Rust-Wert hat genau einen Owner und wird verworfen (dropped), sobald der Owner den Gültigkeitsbereich verlässt; das Übergeben eines Werts verschiebt ihn (move), ausser der Typ ist Copy, und Referenzen leihen ihn (borrow) unter der Regel: entweder eine veränderliche oder beliebig viele gemeinsame Referenzen gleichzeitig. Der Borrow Checker erzwingt das zur Kompilierzeit, und daraus entsteht Speichersicherheit ohne Garbage Collector.
-
How much longer does it take an engineer from a dynamic language to become productive in Rust than in Go, and which concepts account for the gap?
Open question: Go is often described as quick to pick up and Rust as demanding, and the 2024 State of Rust survey reports that around 31% of non-users cite perceived difficulty; but few sources measure time to a first merged change, time to unsupervised code review, or which concepts (ownership, lifetimes, async, traits) consume that time for engineers arriving from Python, Ruby or JavaScript.
-
Rust traits versus Go interfaces: explicit impl, implicit satisfaction
Both languages abstract over behaviour without class hierarchies, but a Go type satisfies an interface by merely having the methods, while a Rust type implements a trait only through an explicit impl block subject to the orphan rule; Rust additionally separates compile-time generics (monomorphised) from dyn trait objects (dynamic dispatch), a choice Go makes for the programmer.
-
Result, Option and the ? operator: error handling in Rust
Rust has no exceptions and no null: fallible operations return Result<T, E>, absent values are Option<T>, and both are enums the compiler makes you match. The ? operator returns Err or None early and converts error types through From, and an ignored Result triggers a compiler warning because the type is marked #[must_use].
-
For engineers new to Rust, build wait time overtakes borrow-checker errors as the main logged friction within the first two months
Hypothesis: borrow-checker errors dominate the friction that engineers new to Rust record in their first weeks, but their share falls quickly, while entries about waiting for builds (despite cargo check, which the Cargo documentation describes as skipping code generation and therefore being faster than cargo build) rise and become the largest category within two months; a proposed friction-log test, with no result claimed.
Maschinenlesbar: JSON