I try to put the config file outside the default path and use --config to specify it. However, the program fails to parse the config path
$ RUST_BACKTRACE=1 cargo run --release -- --config config.yaml -d 23141761
Compiling bili-live-chat v0.1.0 (/home/ulysses/Git/bili-live-chat)
Finished release [optimized] target(s) in 4.43s
Running `target/release/bili-live-chat --config config.yaml -d 23141761`
thread 'main' panicked at 'Mismatch between definition and access of `config`. Could not downcast to TypeId { t: 15790872368546094999 }, need to downcast to TypeId { t: 1345200085165903335 }
', /home/ulysses/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/clap-4.1.1/src/parser/error.rs:30:9
stack backtrace:
0: rust_begin_unwind
at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
2: clap::parser::matches::arg_matches::ArgMatches::get_one
3: bili_live_chat::cli_init
4: tokio::runtime::park::CachedParkThread::block_on
5: tokio::runtime::runtime::Runtime::block_on
6: bili_live_chat::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I try to comment out the path buf settings in --config parser then the program can start normally.
I try to put the config file outside the default path and use
--config
to specify it. However, the program fails to parse the config pathI try to comment out the path buf settings in
--config
parser then the program can start normally.This is a temporary solution, there must be some other ways to do the path check, but I am not familiar with Rust programming.