Has there been any thought about creating an abstraction that could represent file system access (as a trait or maybe something else)? That is, an abstraction that isn’t bound to the actual local filesystem. This isn’t a pre-RFC because I’m not really sure what it would look like. Probably a trait implemented by
File or a type parameter (defauling to
OpenOptions (or both)?
The goal for me would be to be able to write code that can be tested without touching the disk. Though reading and writing can be abstracted, if code needs to access actual file locations, I don’t know a way to test it without setting up a mock directory. I’d much rather be able to mock the file system in memory.
Possibly there are other uses when you have multiple filesystems coexisting but I’m not sure.