diff options
Diffstat (limited to 'src/builder/edit_channel.rs')
| -rw-r--r-- | src/builder/edit_channel.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/builder/edit_channel.rs b/src/builder/edit_channel.rs index b8d897b..e1b62a7 100644 --- a/src/builder/edit_channel.rs +++ b/src/builder/edit_channel.rs @@ -80,13 +80,16 @@ impl EditChannel { /// /// [text]: ../model/channel/enum.ChannelType.html#variant.Text /// [voice]: ../model/channel/enum.ChannelType.html#variant.Voice - pub fn category<C>(mut self, category: C) -> Self - where C: Into<Option<ChannelId>> { - let parent_id = match category.into() { + #[inline] + pub fn category<C: Into<Option<ChannelId>>>(self, category: C) -> Self { + self._category(category.into()) + } + + fn _category(mut self, category: Option<ChannelId>) -> Self { + self.0.insert("parent_id", match category { Some(c) => Value::Number(Number::from(c.0)), None => Value::Null - }; - self.0.insert("parent_id", parent_id); + }); self } |