Loading tutorials
println!("...") and the text that appears on screen. It assumes you can write and run a basic Rust program with cargo run. It also assumes you know what a trait is, but not how to implement one. Later chapters cover the details of `4 min readmain function and run it with cargo run. It also assumes you know that println! takes a format string with {} placeholders. Here you will learn the three ways a placeholder can find the value it prints, how they combine, and which mistakes the 4 min read{ and } as ordinary characters. It assumes you can write println! calls with {} placeholders, positional arguments, named arguments, and inline captured variables like {name}. You should also know that println!, format!, and write! all share one forma4 min read{} placeholder asks of a type, which standard types satisfy it, and the errors you get when a type doesn't. It assumes you can write a basic Rust program, know what a struct is, and have seen println! with {}. It also assumes you know a trait is a named set of meth5 min readcargo run, that you know what a trait is, and that you have seen {} placeholders in println!. The previous chapter covered Display, which produces text for end users. This chapter covers Debug, its counterpart for the people who write and main4 min readcargo run. It also assumes you know that a trait is a set of methods a type can implement. You should have seen {:?} as the Debug placeholder in the previous chapter.3 min readDebug on structs and enums and print with {:?}. It covers the alternate flag # applied to Debug, which gives indented multi-line output. You will see what the layout looks like, how other format options interact with it, and what a manual Debug implementat4 min readprintln! calls with {} placeholders and know the difference between Display ({}) and Debug ({:?}). Here you will learn how to make output occupy a fixed number of characters. That is the basis for aligned columns, headers, and simple tables.4 min read.N), the sign flag (+), and the zero flag (0). It assumes you have read the earlier chapters on placeholders, Display, and width, fill, and alignment. You should be comfortable with a spec like {:>8}.4 min read{} placeholder, width, fill, and alignment, and the 0 flag from the earlier chapters. You should also know what a trait is, because each type charact4 min read{:8} or {:.2}. It also assumes you know that println! and format! take the same format syntax. Here you will learn to take the width or precision from a variable or an argument, so that the layout can depend on yo4 min readprintln! with {} and {:?}, basic traits, and the Result type with the ? operator. It covers the other macros built on the same format-string machinery. They differ in where the text goes: a new String, standard error, or any writer you choose.4 min read{} placeholder from earlier chapters. By the end, you will be able to make your own types work with println!, format!, and to_string().3 min readfmt::Display for a struct, as covered in the previous chapter. You should also know the width, fill, alignment and precision specifiers such as {:>8} and {:.2}.3 min readDebug and how {:?} and {:#?} print values. It also assumes you have seen the Display implementation pattern with write! and a Formatter. Here you will write Debug by hand and learn when that is worth doing.4 min readDebug for a struct (covered earlier in this tutorial) and that you know the basics of ownership: a value is moved when you pass it by value. You should also know that println! writes to standard output and eprintln! writes to standard error.5 min readprintln! with {} and {:?}, and know that Display and Debug are traits. It explains which mistakes in a format string the compiler rejects and which ones it cannot catch.4 min read