Razaekel / noise-rs

Procedural noise generation library for Rust.
Apache License 2.0
842 stars 118 forks source link

Added Clone impls for all noise functions #308

Closed vallentin closed 1 year ago

vallentin commented 1 year ago

Not sure if this is intentional. But I was trying to create a wrapper for some of the noise functions and operators. I wanted to impl Clone, but wasn't able to, because some functions weren't implementing Clone.

Razaekel commented 1 year ago

The problem with cloning noisefns is that Clone does a deep copy of all the elements in the noisefn, including the source noisefns, This could end up recursive, all the way to the initial generators.

vallentin commented 1 year ago

The final call is of course up to you. Personally I don't see any issue though. I think it's common knowledge, that Copy is considered cheap, while Clone is considered more expensive.

Alternatively, maybe it could be feature-gated. At least I don't see, why it would be desirable to be completely unable to clone noise functions, regardless of cost.