Display
Display is Rust’s standard formatting trait for producing a user-facing textual representation of a value.
Refactoring to Rust
The Display trait is Rust's formatting trait for producing a user-facing textual representation of a value.
- How it is used
- Uses Display to centralize user-facing error messages in a calculator.
- How deep it goes
- Walks through implementing fmt with Formatter and write!, including a match over error variants.
- Examples
- Uses a Hello World type and calculator errors for invalid numbers and empty-stack operations.
- What you can do after
- Build a Display implementation from scratch and use it to print custom error messages.
Rust Web Development
Display is a Rust formatting trait for representing values in human-readable, user-facing form.
- How it is used
- Provides readable output for custom values and API errors.
- How deep it goes
- Walks through implementing fmt with Formatter and write!, including nested fields and enum variants.
- Examples
- Uses a question with an identifier and optional tags, plus pagination errors for invalid or missing parameters.
- What you can do after
- Build it from scratch by implementing Display for a custom struct or error enum.
Learn Rust in a Month of Lunches
Display printing formats a Rust value using its user-facing Display formatting behavior.
- How it is used
- Formats user-facing values and customizes application output.
- How deep it goes
- Explains formatting and a custom implementation, while leaving the formatter variable and lifetime syntax unexplained.
- Examples
- Uses a failed unit-value print and a custom Cat with name and age fields.
- What you can do after
- Build a Display implementation for a custom type and print it with {}.
Read how Learn Rust in a Month of Lunches explains Display →
Rust in Action: Systems programming concepts and techniques
The Display trait is Rust's standard formatting trait for producing a user-facing textual representation of a value.
- How it is used
- Formats custom values for console output, strings, formatted writers, and user-facing error messages.
- How deep it goes
- Defines the fmt contract and demonstrates nested implementations, but leaves Formatter details largely unexplored.
- Examples
- Uses File and FileState formatting plus an UpstreamError enum that reuses Debug output.
- What you can do after
- Build it from scratch by implementing Display for structs, enums, nested fields, and wrapper error types.
Read how Rust in Action: Systems programming concepts and techniques explains Display →
What to know first
- DebugDebug is a Rust standard-library formatting trait for producing programmer-oriented representations of values.
- result typeA result type represents the outcome of an operation as either a successful value or a failure, often carrying information about either outcome.
- RustRust is a statically typed systems programming language designed for performance, concurrency, and memory safety without requiring garbage collection.
- vectorA vector is an ordered sequence of elements treated as a single object, with its size fixed or resizable depending on the context.
Related concepts
- Debugcontrasts with · Debug is a Rust standard-library formatting trait for producing programmer-oriented representations of values.
- println! macroused by · In Rust, println! is a standard-library macro that formats arguments and writes the resulting text followed by a newline to standard output.
- traitkind of · A trait is a type-level construct that defines reusable behavior or members that types can implement or compose.
- ToStringproduces · ToString is an operation or interface that converts a value into a string representation.
- slicingimplemented by · Slicing selects or partitions a portion of an indexed sequence or multidimensional array, often along specified indices or dimensions.
Questions about Display
What is Display?
Display is Rust’s standard formatting trait for producing a user-facing textual representation of a value.
Which Manning books explain Display?
Refactoring to Rust, Rust Web Development, Learn Rust in a Month of Lunches and Rust in Action: Systems programming concepts and techniques.
What should I know before learning Display?
Manning books that teach Display usually introduce Debug, result type, Rust and vector first.
What is the difference between Display and Debug?
Display is Rust’s standard formatting trait for producing a user-facing textual representation of a value. Debug is a Rust standard-library formatting trait for producing programmer-oriented representations of values.
What is Display a kind of?
Display is a kind of trait. A trait is a type-level construct that defines reusable behavior or members that types can implement or compose.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



