Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
EditRole::icon
and EditRole::unicode_emoji
nullable in addit…
…ion to undefined (serenity-rs#2539) All `EditRole` fields are skipped when they are `None`. This does not work for `EditRole::icon` and `EditRole::unicode_emoji` because the field being `undefined` is different from the field being `null` at the API: if the field is `undefined` it will be kept unchanged, and if it is `null` it will be cleared. With a double `Option` it is possible to distinguish `undefined` from `null` from a set value. This is the [canonical](serde-rs/serde#984 (comment)) solution using serde (the example shows de-serialization but it works the same in reverse). Then, `None` is "keep field unchanged", `Some(None)` is "clear this field" and `Some(Some(value)` is "set this field to this value" # Breaking changes - `EditRole::unicode_emoji()` takes a `Option<String>` instead of `impl Into<String>`. - `EditRole::icon()` takes a `Option<&CreateAttachment>` instead of `&CreateAttachment`
- Loading branch information