Sherlock-Holo / fuse3

an async version fuse library for rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement request: use i32 as error type for Filesystem

asomers opened this issue · comments

fuse3 currently defines a custom Error type, a wrapper around errno, which implements From<i32>. That is pretty convenient to use for a crate whose native errors are also i32, or whose custom error type can implement Into<fuse3::Errno>. However, it's a problem for a crate whose custom error type comes from a third crate, because Rust's trait impl rules don't allow a crate to implement From or Into to convert between two external types.
Looking at the source, it seems the fuse3::Error type only exists for the sake of a few one-line convenience methods like is_not_exist and new_not_exist. I think the switch could be done with almost no net change in line count. If you agree, I can prepare a PR.

the fuse3::Errno also implement From<std::io::Error>, that can help user convert the io error to Errno, or when they want to convert to the io::Error, they can use err.into() directly

Which helps if their crate's native error type is io::Error, but not other arbitrary error types. For example, in my case it's nix::Errno.