Coming to Rust from Java

What Changes

Rust shifts from Java's garbage collection to compile-time ownership rules and uses `cargo` for project management.

Rust replaces Java's garbage collection with ownership rules that prevent memory errors at compile time, and uses cargo instead of Maven or Gradle for building. Unlike Java's class-based structure, Rust relies on functions, structs, and traits, often requiring explicit error handling via Result types. Here is a minimal web server example showing Rust's standard library usage:

use std::net::TcpListener;

fn main() {
    let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
    for stream in listener.incoming() {
        let stream = stream.unwrap();
        println!("Connection established!");
    }
}

Run this code with cargo run after initializing a project with cargo new my_project.