Remix.run Logo
▲ layer8 4 hours ago

Rust doesn’t have implementation inheritance. If it did, it would need a constructor-like concept as well.

▲gpderetta 2 hours ago | parent [-]

With guaranteed RVO you could do something like this (pseudo-C):

   struct FooBase { ... }
   fn make_foo_base(...) -> FooBase
   struct Foo { base : FooBase; ... }
   fn make_foo(args...) -> Foo {
      return { .base = make_foo_base(...), ... }
   }