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

Why does Engine::eval_file_with_scope use PathBuf instead of Path? #692

Open
starovoid opened this issue Jan 19, 2023 · 4 comments · May be fixed by #693
Open

Why does Engine::eval_file_with_scope use PathBuf instead of Path? #692

starovoid opened this issue Jan 19, 2023 · 4 comments · May be fixed by #693

Comments

@starovoid
Copy link

Why is the file path passed to Engine::eval_file_with_scope as PathBuf instead of Path? I'm a little surprised by this decision, because it can provoke an extra allocation.

@schungx
Copy link
Collaborator

schungx commented Jan 20, 2023

Well, for historical reasons... The API is fixed so I can't easily change it to Path without breaking code.

It probably should be changed to a generic impl Into<Path>

@starovoid
Copy link
Author

Thanks for the quick response, I hope these changes will come someday. And... Can I contribute to this?

@schungx
Copy link
Collaborator

schungx commented Jan 20, 2023

Of course. Your contributions are welcome.

Actually very few people use the file API (I guess) so it may actually not be very risky to change...

But of course being as compatible as possible is best.

@starovoid
Copy link
Author

I opened the pull request with these changes

@schungx schungx pinned this issue Jan 24, 2023
@schungx schungx unpinned this issue Jan 24, 2023
@schungx schungx linked a pull request Jan 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants