Closed ludiazv closed 4 years ago
Does this section of the user's guide address your issue?
It looks like you need
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum Error {
Opinion-wise, I don't think there's much benefit to placing your Error
type in a module if you are going to be creating it from outside of that module.
Thanks!!!! It worked! I tried with visibility but somehow I wrote the directive wrong. I wnated to same same error across various module. It could an anti-pattern but for small programs will reduce the boilerplate and simplify error management at main program level as we have to deal with unique Result.
Thank you for your help.
I wnated to same same error across various module
That's fine, I'd just define the error type at the root of your hierarchy, instead of putting it in a module at all.
Hi, I'm testing snafu and I'm trying to use it in submodule but I can't get it to compile. This is the test code:
The output is the following:
Changing line with the error to:
I get this:
If I try this:
I get:
The code works fine if I remove the
error_module
What I'm doing wrong?. I'm using rust 2018, rustc 1.37 on linux.Thanks