diff options
Diffstat (limited to 'src/group.rs')
-rw-r--r-- | src/group.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/group.rs b/src/group.rs index c01d5ae..43c4d65 100644 --- a/src/group.rs +++ b/src/group.rs @@ -18,7 +18,7 @@ use crate::{ client::{self, Client}, error::Error, }; -use serde::{Serialize, Serializer}; +use serde::Serialize; pub struct GroupFetcher<'a> { client: &'a Client, @@ -35,21 +35,13 @@ impl<'a> GroupFetcher<'a> { } +#[derive(Debug, Serialize)] enum GroupSelector<'a> { + #[serde(rename(serialize = "group_id"))] Id(u64), - Name(&'a str), -} -impl<'a> Serialize for GroupSelector<'a> { - fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> - where - S: Serializer, - { - match *self { - GroupSelector::Id(id) => [("group_id", id)].serialize(serializer), - GroupSelector::Name(n) => [("group_name", n)].serialize(serializer), - } - } + #[serde(rename(serialize = "group_name"))] + Name(&'a str), } pub struct GroupMembersFetcher<'a> { |