Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Closures With Copy And Clone #661

Closed
TheDarkula opened this issue May 11, 2018 · 3 comments
Closed

Closures With Copy And Clone #661

TheDarkula opened this issue May 11, 2018 · 3 comments

Comments

@TheDarkula
Copy link

Now that closures implement Copy and Clone
Does this mean we should be able to get rid of builder.clone() calls?
Would it be as simple as adding #[derive(Clone, Copy)] to the Builder struct?

@sdroege
Copy link
Member

sdroege commented Oct 10, 2018

can you give a code example what exactly you mean?

@TheDarkula
Copy link
Author

I didn't have one exactly. What I was wanting to do was be able to have the Builder struct implement the Clone trait, so we don't have to use a clone! macro or do .clone() calls on it.

I couldn't track down exactly where the Builder struct was in the gtk-rs source code, but the pseudo-code would look something like this:

#[derive(Clone, Copy)]
struct Builder {
// fields omitted
}

@sdroege
Copy link
Member

sdroege commented Oct 10, 2018

gtk::Builder is already implementing Clone. It can't possibly implement Copy as that is only possible to derive and is limited to basic types and combinations of them.

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

No branches or pull requests

3 participants