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

Derive Clone #5

Closed

Conversation

MercuricChloride
Copy link

I ran into an issue where a crate I was working with required a particular type to implement the Clone trait to work nicely with it.

I don't see a reason that Clone shouldn't be derived so I am opening this PR to add it.

@maoueh
Copy link
Contributor

maoueh commented Mar 21, 2024

Technically, I would refrain from using Clone, it's not the expected usage of this, using Clone might leave you with different structure, could be ok but seems recipe for nasty errors.

What is the use case that made you need to use Clone?

@MercuricChloride
Copy link
Author

Technically, I would refrain from using Clone, it's not the expected usage of this, using Clone might leave you with different structure, could be ok but seems recipe for nasty errors.

What is the use case that made you need to use Clone?

I am building a series of plugins for the rhai scripting language to work nicely with substreams. But in order for types to work automagically inside of the rhai runtime, they must implement clone, regardless of if they are actually cloned or not during usage, because of the trait boundaries.

I ended up going with a different approach to solving this though, so I will close this.

Next time I will also provide a bit more context with the PR, didn't realize how short I made it!

@maoueh
Copy link
Contributor

maoueh commented Mar 22, 2024

I am building a series of plugins for the rhai scripting language to work nicely with substreams

Keep me posted on Discord about this, quite curious to see the result.

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

Successfully merging this pull request may close these issues.

2 participants