From the course: Rust Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Implement the display trait

Challenge: Implement the display trait - Rust Tutorial

From the course: Rust Essential Training

Start my 1-month free trial

Challenge: Implement the display trait

- [Narrator] Surprise. It's challenge time again. This time to practice implementing traits. Your goal this time is to implement the display trait for a custom struct representing a satellite. Display is a fairly common trait which gives data types the ability to produce user facing output. To complete this challenge you'll need to refer to the documentation for the display trait shown here to implement the required methods. I've included this code in the exercise files as a starting point. Which defines a custom struct named, Satellite. And then in the main function, initializes a satellite for the Hubble Space Telescope. And then calls the print macro on it. You can replace the comment on line six with your own code to implement the display trait for a satellite. I'll leave the exact text of what it displays up to you. But you should at least include the satellite's name and velocity. As a hint, in order to implement the…

Contents