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/builder/get_messages.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/builder/get_messages.rs')
| -rw-r--r-- | src/builder/get_messages.rs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/builder/get_messages.rs b/src/builder/get_messages.rs index f302ff0..2d7ee87 100644 --- a/src/builder/get_messages.rs +++ b/src/builder/get_messages.rs @@ -55,24 +55,39 @@ pub struct GetMessages(pub VecMap<&'static str, u64>); impl GetMessages { /// Indicates to retrieve the messages after a specific message, given by /// its Id. - pub fn after<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("after", message_id.into().0); + #[inline] + pub fn after<M: Into<MessageId>>(self, message_id: M) -> Self { + self._after(message_id.into()) + } + + fn _after(mut self, message_id: MessageId) -> Self { + self.0.insert("after", message_id.0); self } /// Indicates to retrieve the messages _around_ a specific message in either /// direction (before+after) the given message. - pub fn around<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("around", message_id.into().0); + #[inline] + pub fn around<M: Into<MessageId>>(self, message_id: M) -> Self { + self._around(message_id.into()) + } + + fn _around(mut self, message_id: MessageId) -> Self { + self.0.insert("around", message_id.0); self } /// Indicates to retrieve the messages before a specific message, given by /// its Id. - pub fn before<M: Into<MessageId>>(mut self, message_id: M) -> Self { - self.0.insert("before", message_id.into().0); + #[inline] + pub fn before<M: Into<MessageId>>(self, message_id: M) -> Self { + self._before(message_id.into()) + } + + fn _before(mut self, message_id: MessageId) -> Self { + self.0.insert("before", message_id.0); self } |