Replies: 2 comments 3 replies
-
Sounds good to me. There are still things to review throughout the library, especially ergonomics, to make it easier to use and improve the error system. I'm going to try to get it done this week. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Reviewing this, it's something I thought about at the time. But you can't mix traits with generics so easily: fn read_to_string<P: AsRef<Path>>(&mut self, path: P) -> ForensicResult<String>; This will cause all functions that return Box to fail at compile time since the trait cannot be dyn compatible. The alternative is to create ergonomic wrappers: impl dyn VirtualFileSystem {
/// Read the entire contents of a file into a string.
pub fn read_to_string_path<P: AsRef<Path>>(
&mut self,
path: P,
) -> ForensicResult<String> {
self.read_to_string(path.as_ref())
}
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a proposition to replace some VFS API to use
AsRef<Path>
instead ofPath
. This would allow to use&str
literals, without additional.as_ref()
.Beta Was this translation helpful? Give feedback.
All reactions