-
Notifications
You must be signed in to change notification settings - Fork 45
Expose a file_list API + VfsPath::as_filesystem #73
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
base: master
Are you sure you want to change the base?
Conversation
Have also fixed up the RwLock unwrap a bit by adding a new error variant |
Have also applied a few optimizations with a new Filesystem trait method read_to_string and read_to_bytes with a default impl from VfsPath. MemoryFS then overrides this default impl to avoid buffering / extra copying/extra RwLock calls etc where not needed [errors to be fixed soon along with access time related things] |
Thanks for the PR. I would really like to better understand the use cases for things like What specific use cases do you have in mind? |
Another API I'll prob be adding to vfspath (at least in my fork) is the ability to just set the path with fs (e.g. VfsPath::from_path(&str, Filesystem)) which is another pretty important API that I've been working around the lack of so far. |
Hi again, thanks for your reply! In general, I'd like to keep the API surface quite focused and minimal. Regarding Using the VfsPath read to string/bytes should not be significantly slower, Hiding the actual filesystem is a deliberate choice, to clearly and strongly separate the consumer facing API ( Maybe you could show some concrete example in the lua integration code, to help me better understand the underlying use cases and figure out what the options are. |
file_list is really useful for my usecase of updating an in memory filesystem from a hashmap and may be useful for other cases as well. For now, this is only implemented in in-memory FS where it can be done quickly (and could be optimized even further in future). VfsPath::as_filesystem is useful for extracting out the filesystem from a VfsPath