fern icon indicating copy to clipboard operation
fern copied to clipboard

`SharedDispatch` type is not accessible

Open Luro02 opened this issue 1 year ago • 2 comments

I can call fern::Dispatch::into_shared, but when I try to return it from a function:

fn setup_logger(output: fern::Output) -> fern::SharedDispatch {
    let shared = fern::Dispatch::new()
        .into_shared();
    return shared;
}

I get an error.

error[E0412]: cannot find type `SharedDispatch` in crate `fern`
   --> runner\src\main.rs:279:49
    |
279 | fn setup_logger(output: fern::Output) -> fern::SharedDispatch {
    |                                                ^^^^^^^^^^^^^^ not found in `fern`

For more information about this error, try `rustc --explain E0412`.

The type cannot be clicked on in the docs as well: https://docs.rs/fern/latest/fern/struct.Dispatch.html#method.into_shared

I guess one has forgotten to export the type? https://github.com/daboross/fern/blob/4f45ef9aac6c4d5929f100f756b5f4fea92794a6/src/lib.rs#L266-L270

Luro02 avatar Mar 29 '23 09:03 Luro02

@daboross Python guy here practicing my hand at Rust would like to take a stab at this and submit a PR for a fix.

timothyhutz avatar Mar 08 '24 02:03 timothyhutz

Here is my PR that should fix the public visibility of that struct in the crate https://github.com/daboross/fern/pull/133

timothyhutz avatar Mar 08 '24 02:03 timothyhutz