Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impls and derive for Merge trait #24

Open
xmakro opened this issue Aug 30, 2022 · 1 comment
Open

Impls and derive for Merge trait #24

xmakro opened this issue Aug 30, 2022 · 1 comment

Comments

@xmakro
Copy link

xmakro commented Aug 30, 2022

It would be useful if Merge was implemented for common containers such as HashMap and if it could be derived for structs.

#[derive(Default, Merge)
struct A {
  hello: Mean,
  world: HashMap<String, Max>,
}

let mut x = A::default();
let y = A::default();
x.merge(y);

I'm happy to send a PR if you agree with this. It might require a new crate average_derive for the derive macros.

@vks
Copy link
Owner

vks commented Oct 5, 2022

Indeed, supporting derive would be more user-friendly than the current macros and makes sense.

Implementing Merge for containers is an interesting idea, I need to think a bit about the semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants