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

Support getting files etc. in const #76

Closed
ModProg opened this issue Feb 25, 2022 · 2 comments
Closed

Support getting files etc. in const #76

ModProg opened this issue Feb 25, 2022 · 2 comments

Comments

@ModProg
Copy link

ModProg commented Feb 25, 2022

Not sure if this is achievable witht the current architecture, but I would like to be able to query files in const. Hopefully this gets done in the need future so I could then also unwrap the resulting file: rust-lang/rust#67441.

@Michael-F-Bryan
Copy link
Owner

The Dir::entries() getter is const, so you should already be able to look up files at compile time.

You'd need to write your own recursive search function though. I don't think the existing methods for looking up items (e.g. Dir::get_file()) can be made const because they take some S: AsRef<Path> and traits aren't allowed in const contexts yet.

@ModProg
Copy link
Author

ModProg commented Feb 26, 2022

Alright, makes sense.

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

No branches or pull requests

2 participants