Email the Author
You can use this page to email Behrang Saeedzadeh about Mastering Rust for Java Programmers.
About the Book
If you're a Java developer looking to learn Rust, you already know the language's reputation: powerful, safe, but notoriously difficult to learn. This book takes a different approach—instead of overwhelming you with ownership rules and lifetimes from day one, it uses the Spiral Learning System to teach Rust progressively through focused domains.
This is Spiral 1, which teaches Rust through the lens of printing and formatting output. Future spirals will expand to cover the entire Rust language, building on the solid foundation established here.
Why start with printing? Because it's something you use constantly, from your first "Hello, World!" to debugging complex production systems. By exploring Rust's printing and formatting system in depth, you'll naturally encounter and master the language's core concepts—ownership, borrowing, traits, generics, and error handling—in practical, immediately useful contexts. These fundamentals prepare you for any aspect of Rust programming.
What Makes This Book Different:
- Built for Java Developers: Every concept is explained through direct comparisons to Java. You'll see how Rust's `Display` trait relates to `toString()`, how `Result` compares to checked exceptions, and how Rust's formatting system differs from `String.format()` and `printf()`.
- Spiral Learning System: Following Jerome Bruner's spiral curriculum theory, concepts are introduced simply, then revisited with increasing depth. You'll glimpse `impl` blocks early, explore them in detail later, then apply them with confidence in advanced scenarios.
- Hands-On Throughout: Every concept is demonstrated with complete, runnable code examples. You'll build real formatting implementations, write custom `Display` and `Debug` traits, and explore performance optimizations with actual measurements.
- Focused Yet Comprehensive: Rather than trying to cover all of Rust at once, Spiral 1 focuses deeply on printing and formatting. This creates a coherent narrative thread that naturally introduces Rust's type system, trait system, error handling, and performance characteristics—all the fundamentals you need to continue learning Rust or to dive into future spirals as they're released.
What You'll Learn:
Starting from basic console output, you'll progress through Rust's formatting machinery, learning to:
- Master `print!`, `println!`, `format!`, and the `write!` family of macros
- Implement `Display` and `Debug` traits for custom types
- Control formatting with precision, padding, alignment, and custom specifiers
- Write output to files, network streams, and in-memory buffers
- Build efficient string formatting with zero allocations
- Apply performance optimizations based on actual profiling data
By the end of Spiral 1, you won't just understand Rust's printing system—you'll have internalized the ownership model, trait system, and error handling patterns that make Rust powerful. These fundamentals form the foundation for everything else in Rust, whether you continue with future spirals or explore Rust independently.
Who This Book Is For:
This book is designed for Java developers with solid programming fundamentals who want to learn Rust. You should be comfortable with:
- Object-oriented programming concepts (classes, interfaces, inheritance)
- Java's type system and generics
- Basic I/O operations and exception handling
- Reading and writing code in any C-family language
No prior Rust experience is required—just a `cargo new` "Hello World" project and curiosity about systems programming.
Spiral 1 Structure:
Spiral 1 is organized into five progressive parts:
1. Foundations - Understand Rust's output model and macro system
2. Basic Printing - Master console output and basic formatting
3. The Formatting System - Explore traits, format specifiers, and string building
4. Custom Types and Advanced Output - Implement custom formatting and write to any destination
5. Performance and Best Practices - Optimize for production and apply advanced techniques
Each part builds naturally on the previous, with concepts reinforced through practical examples and Java comparisons. Future spirals will continue this progressive approach, expanding into other domains of Rust programming.
Why Start with Spiral 1:
Rust is becoming essential for performance-critical systems, cloud infrastructure, and embedded development. But learning Rust shouldn't mean fighting the compiler for weeks before writing useful code. Spiral 1 gives you a structured, focused entry point—teaching you core language features through a practical, immediately useful domain.
Whether you're evaluating Rust for your next project, migrating Java services to Rust for performance, or simply curious about systems programming, Spiral 1 provides the solid foundation you need. Master the fundamentals through printing and formatting, then apply that knowledge across the entire Rust ecosystem.
About the Author
I am an enterprise Java and Web developer with more than 20 years of experience writing programs and applications for banks, insurance companies, the media, and the public sector.