Rewrite find files in O(lg(n)), and clean up the api#37
Open
erickt wants to merge 7 commits intoMichael-F-Bryan:masterfrom
Open
Rewrite find files in O(lg(n)), and clean up the api#37erickt wants to merge 7 commits intoMichael-F-Bryan:masterfrom
erickt wants to merge 7 commits intoMichael-F-Bryan:masterfrom
Conversation
The interface include_dir exposes hasn't changed, so I've only done a minor bump to 0.2.2, but include_dir_impl now exports `include_dir`, so I've given it a major bump. It also raises the minimum tested version to rust 1.31.0, the first version that added support for editions.
Not all operating systems guarantee that paths can be converted to unicode. So to be safe, this PR panics instead of silently replacing invalid unicode characters with the unicode replacement character.
This PR makes some large changes to the library, in order to reduce finding a file from O(n) to O(lg(n)), by maintaining the directory entries in a sorted order, and binary searching for a file. In order to accomplish this, I changed how directories work. Instead of each directory supporting the ability to look up a path relative to the root directory, I instead introduce a `FileSystem` that is the entrypoint for resolving a path into contents. This is more analogous to how std::fs operates.
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrite find files in O(lg(n)), and clean up the api …
This PR makes some large changes to the library, in order to
reduce finding a file from O(n) to O(lg(n)), by maintaining
the directory entries in a sorted order, and binary searching
for a file.
In order to accomplish this, I changed how directories
work. Instead of each directory supporting the ability to look
up a path relative to the root directory, I instead introduce
a
FileSystemthat is the entrypoint for resolving a path intocontents. This is more analogous to how std::fs operates.