Debugging is the process of figuring out and fixing bugs in your software. Oftentimes, in order to aid in the debugging, we like to be able to print out some values. The Display trait is intended for user-friendly output. And there’s no way to derive a Display trait. For debugging, we’re often happy to let the compiler just generate some kind of output. To facilitate this, we have the Debug trait, which supports deriving. Let’s see this in practice:

Get hands-on with 1000+ tech skills courses.