Introduce an option for disabling the automatic resolver in FileSourceFile
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 265
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
If someone needs to import a specific file, excluding the resolve process, with the actual structure is impossible.
Example:
The config file in the folder is called "config.toml" but the user asks for the file "config.ayeye". If I'm building the File with new or with_name, especially with new where you tell the FileFormat, the resolver in /src/file/source/file.rs line 37 if the file not exist search anyway other files with the same basename but one of the valid acceptable extension, reading the configuration from "config.toml" even if there was an error in the name.
That characteristic I'm sure is intended as a feature but in some peculiar case it can produce some very boring error, and only because the resolver cannot be disabled.
I'm proposing three solutions:
- Introduce a new
FileSourcenamedFileSourceExactFileand a new method inFilenamedwith_exact_name(&str, FileFormat)where the resolver is disabled. (I don't really like it as a solution) - Add a flag to the
FileSourceFilestruct nameduse_resolverand modify the signature ofnewand/orwith_name. (Breaking change is a big negative point) - Add a flag to the
FileSourceFilestruct nameduse_resolverand add a method inFile<FileSourceFile>similar torequired(bool)where the user can enable or disable the resolver inFileSourceFile(The best solution. No breaking change, no removing of feature, only adding an option flag that if not used will be set toTruefor retro compatibility)
I'm building the solution 3 for my project, if it is accepted as a good idea, when ready I will send a Pull Request.
Opinion? Question? Observation?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in /src/file/source/file.rs at line 37 and trace how FileSourceFile resolves alternate extensions when the requested file is absent. Review the existing File constructors and required(bool)-style APIs, then define tests that verify the resolver remains enabled by default and can be disabled for an exact filename.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100