diff options
| author | Zeyla Hellyer <[email protected]> | 2018-07-04 21:28:22 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-07-04 21:32:17 -0700 |
| commit | 7b9764cf1097b0620d871fabe67b5593f0cd4a4a (patch) | |
| tree | 5b9f3eac6e9c57ac255c73bd1eea07669838f32d /src/model/channel/reaction.rs | |
| parent | Fix dead doc-links and add missing ones. (#347) (diff) | |
| download | serenity-7b9764cf1097b0620d871fabe67b5593f0cd4a4a.tar.xz serenity-7b9764cf1097b0620d871fabe67b5593f0cd4a4a.zip | |
Monomorphize all functions
This commit monomorphizes all functions, turning functions like:
```rust
fn foo<T: Into<Bar>>(baz: T) {
baz = baz.into();
// function here
}
```
Into functions like:
```rust
fn foo<T: Into<Bar>>(baz: T) {
_foo(baz.into())
}
fn _foo(baz: Bar) {
// function here
}
```
This avoids binary bloat and improves build times, by reducing the amount of
code duplication.
Diffstat (limited to 'src/model/channel/reaction.rs')
| -rw-r--r-- | src/model/channel/reaction.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/model/channel/reaction.rs b/src/model/channel/reaction.rs index 88f687f..0f65e8b 100644 --- a/src/model/channel/reaction.rs +++ b/src/model/channel/reaction.rs @@ -151,18 +151,28 @@ impl Reaction { /// [`User`]: struct.User.html /// [Read Message History]: permissions/constant.READ_MESSAGE_HISTORY.html /// [permissions]: permissions + #[inline] pub fn users<R, U>(&self, reaction_type: R, limit: Option<u8>, after: Option<U>) -> Result<Vec<User>> where R: Into<ReactionType>, U: Into<UserId> { + self._users(&reaction_type.into(), limit, after.map(Into::into)) + } + + fn _users( + &self, + reaction_type: &ReactionType, + limit: Option<u8>, + after: Option<UserId>, + ) -> Result<Vec<User>> { http::get_reaction_users( self.channel_id.0, self.message_id.0, - &reaction_type.into(), + reaction_type, limit.unwrap_or(50), - after.map(|u| u.into().0), + after.map(|u| u.0), ) } } |