aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel/channel_id.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-01-05 22:41:18 -0800
committerZeyla Hellyer <[email protected]>2018-01-05 22:41:18 -0800
commit85d7d5f6a6df9841659bc7ad8e392f31c1aae46c (patch)
tree001ea9d81f51f8919a5b07cbea9f64621955dd35 /src/model/channel/channel_id.rs
parentFix permission overwrites in permission building (diff)
downloadserenity-85d7d5f6a6df9841659bc7ad8e392f31c1aae46c.tar.xz
serenity-85d7d5f6a6df9841659bc7ad8e392f31c1aae46c.zip
Further generic-ify `reaction_users` `after` param
Further generic-ify the `after` parameter on the `reaction_users` method of the following structs: - `ChannelId` - `Group` - `GuildChannel` - `Message` - `Channel` - `GuildChannel` Do this by changing the `U` trait bound from `Into<UserId>` to `Into<Option<UserId>>`. This resolves problems determining types when passing `None` as the argument, as reported in #247.
Diffstat (limited to 'src/model/channel/channel_id.rs')
-rw-r--r--src/model/channel/channel_id.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/model/channel/channel_id.rs b/src/model/channel/channel_id.rs
index 8ebdf2a..7093dfb 100644
--- a/src/model/channel/channel_id.rs
+++ b/src/model/channel/channel_id.rs
@@ -358,12 +358,13 @@ impl ChannelId {
/// [`User`]: struct.User.html
/// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html
pub fn reaction_users<M, R, U>(&self,
- message_id: M,
- reaction_type: R,
- limit: Option<u8>,
- after: Option<U>)
- -> Result<Vec<User>>
- where M: Into<MessageId>, R: Into<ReactionType>, U: Into<UserId> {
+ message_id: M,
+ reaction_type: R,
+ limit: Option<u8>,
+ after: U,
+ ) -> Result<Vec<User>> where M: Into<MessageId>,
+ R: Into<ReactionType>,
+ U: Into<Option<UserId>> {
let limit = limit.map_or(50, |x| if x > 100 { 100 } else { x });
http::get_reaction_users(
@@ -371,7 +372,7 @@ impl ChannelId {
message_id.into().0,
&reaction_type.into(),
limit,
- after.map(|u| u.into().0),
+ after.into().map(|x| x.0),
)
}