Simplify Config structure
This simplifies some of the `Config` structure, in particular this means: Parameters which are meaningfully equivalent longer stored in an `Option<T>`, an example of this is `channels`. If you don't want to join any channels you simply leave it as empty instead. In effect, `None` is behaviorally equivalent to `vec![]`. We don't allocate when accessing certain configuration options. For example, when accessing `channels` we used to allocate a vector to handle the "empty case", we simply return the slice corresponding to the list of channels instead. We skip serializing empty or optional configuration fields. From a deserialization perspective this is already something that was mostly supported through use of `Option<T>` and `#[serde(default)]`.
This commit is contained in:
parent
cebd250f00
commit
5189b69e7e
9 changed files with 116 additions and 98 deletions
|
@ -15,7 +15,7 @@ async fn main() -> irc::error::Result<()> {
|
|||
let config = Config {
|
||||
nickname: Some("irc-crate-ci".to_owned()),
|
||||
server: Some("irc.pdgn.co".to_owned()),
|
||||
use_ssl: Some(true),
|
||||
use_ssl: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue