# "extends" key word

**URL:** <https://internals.rust-lang.org/t/extends-key-word/21183>\
**Category:** language design\
**Created:** [July 15, 2024, 3:53pm UTC](https://internals.rust-lang.org/t/extends-key-word/21183 "2024-07-15T15:53:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pitaj](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/pitaj/32/11262_2.png) [@pitaj](https://internals.rust-lang.org/u/pitaj)\
**Post date:** [July 15, 2024, 4:17pm UTC](https://internals.rust-lang.org/t/extends-key-word/21183/2 "2024-07-15T16:17:28Z")

</div>

In my experience, inheritance works best in trivial examples like that one you have, but breaks down quickly in larger projects. It's not an abstraction that generalizes well.

I think something like "delegation" can cover the "struct embedding" case.

> **[delegate - Rust](https://docs.rs/delegate/latest/delegate/)**
>
> This crate removes some boilerplate for structs that simply delegate some of their methods to one or more of their fields.

> [@Potential RFC: Delegation](https://internals.rust-lang.org/t/potential-rfc-delegation/13831):
>
> Pre-RFC: Delegation Many times, it would be useful if we could delegate in rust - the delegation pattern is good and there are many other uses of it (like in the newtype idiom). Currently, all we can do is implement Deref. But this has several disadvantages: If we wanted to actually implement Deref for what it's designed for, we can't We have to inherit all of the methods We can only do it once This is more like extending another class than delegation. So, here's the proposed syntax. trait Fo…

---

_[View the full topic](https://internals.rust-lang.org/t/extends-key-word/21183)._
