Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, I would do (2) if possible.

```

struct Person { name: String, }

struct Engineer { name: String, boss: String, }

trait Name { fn get_name(&self) -> &str; }

impl Name for Person { ... }

impl Name for Engineer { ... }

```




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: