aboutsummaryrefslogtreecommitdiff
path: root/src/builder/get_messages.rs
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-07-04 21:28:22 -0700
committerZeyla Hellyer <[email protected]>2018-07-04 21:32:17 -0700
commit7b9764cf1097b0620d871fabe67b5593f0cd4a4a (patch)
tree5b9f3eac6e9c57ac255c73bd1eea07669838f32d /src/builder/get_messages.rs
parentFix dead doc-links and add missing ones. (#347) (diff)
downloadserenity-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.rs27
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
}