Closed mklcp closed 6 years ago
not sure but I think you might want to remove the field data of discord_token
(just as a note)
Oh yes, not needed for a minimal working example; but that doesn't change the problem either :)
So, I wouldn't really call this a bug per se. It is actually expected behavior, but I recognize that that's not necessarily the best answer. The options field is just a HashMap of Strings to Strings. That's why you're getting an error when using the array.
That being said, I would like to fix this somehow, but I'm not sure what the best way of doing it is. Unfortunately, I think the best practice right now is to roll-your-own config if you want to do something particularly involved over what this library offers. There ought to be a better way to set up configurations. If nothing else, maybe just making it easier to build your own data structure (probably by shrinking the current Config somewhat, removing options, and adding some nice macros). I'll think about this some more though.
Possibly found the problem: in the struct Config, the field options
has the type Option<HashMap<String, String>>
, which obviously not allow other toml types. For simplicity's sake, it's a understandable to use a <String, String>, but practically, since rust projects often use TOML, it may be good to provide more general features when loading a TOML, just to not have to load several TOML files, or modify the library to modify Config.
Or one can still make a multiline string and invoke a toml parser on it in the program containing irc
; the proposal described is just a small feature (and I've understand the problem myself, so this issue becomes less useful); at least modifying the description of the [options]
part to precise that it only allow strings would be good.
[EDIT: you posted before me; then nothing to add I think; so I close the issue.]
Hello,
I'm getting the following error:
when I launch the configuration
with the method
IrcServer::new()
.But with this one:
there's no problems.
This crate is using the crate
toml
; so I've tested if it was a problem oftoml
rather thanirc
, with this program:And this program works for both config expressed above.
I was so wanting to know if it's really a bug in the use of
toml
byirc
, or if there's any mistakes in my approach.Thank you!