Closed udoprog closed 4 years ago
Thanks, this is a great change. The current setup is a hold over either from before serde had all these nice features or possibly just from before I knew any of them existed. The Options were definitely there to deal with skipping over those fields.
This reminds me of a question I had: why is the server field optional?
@ParadoxSpiral it would seem to be to support testing without specifying it. Trying to use a non-mock connection without it will cause it to error. It could be done cleaner.
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 ischannels
. If you don't want to join any channels you simply leave it as empty instead. In effect,None
is behaviorally equivalent tovec![]
.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)]
.