Rust Traits Design Trade-offs
paulefou.com·20h
Preview
Report Post

I’ve spent roughly 4 hours in one sitting trying to figure out this quiz, making all those notes, and I figured that it might make sense to publish them, since I already have them.

Question 1

Requirement: The API client is expected to provide a single WidgetImpl enum representing all possible widgets, and implement the Widget trait for WidgetImpl.

Question 2

Requirement: The API client is expected to provide a unique struct for each possible widget, and implement the Widget trait for each struct. Each widget can return a vector containing widgets of any possible type.

Question 3

Requirement: Only types that implement the Widget trait should be returned from render.

Data Structures

str...

Similar Posts

Loading similar posts...