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

Functions needlessly taking envelope by reference #188

Open
kristoff3r opened this issue Dec 13, 2024 · 1 comment · May be fixed by #189
Open

Functions needlessly taking envelope by reference #188

kristoff3r opened this issue Dec 13, 2024 · 1 comment · May be fixed by #189

Comments

@kristoff3r
Copy link

A lot of functions currently take a T::Envelope by reference, and then immediately clones it. For example locate_in_envelope:

LocateInEnvelope::new(&self.root, SelectInEnvelopeFunction::new(envelope.clone()))

This is both unnecessary and makes it hard to make helper functions that return iterators using these functions. In my current project I want a function to calculate an AABB and return a Box<dyn Iterator<Item = &SomeType>>. But because the envelope is taken by reference I now need to also store the AABB with the same lifetime.

Instead I propose that these functions take ownership of the envelope.

@kristoff3r
Copy link
Author

kristoff3r commented Dec 13, 2024

I also just noticed that the new function for LocateInEnvelope is pub(crate), so I can't easily work around it by using the internal implementation.

@kristoff3r kristoff3r linked a pull request Dec 16, 2024 that will close this issue
2 tasks
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 a pull request may close this issue.

1 participant