Skip to content

RFC: Functional struct update for structs of different types but coinciding field names/types #7143

@bblum

Description

@bblum

I just thought of this and am not sure if there's some practical obstacle to it. Let's say you have:

struct Foo { a: T1, b: T2, c: T3 }
struct Bar { a: T2, b: T2 }

It would be nice to be able to write:

let bar: Bar = ...;
let foo: Foo = { c: type_3_value, ..bar };

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions