From 5f86362f172b557856011d0c052c76bf96e7050a Mon Sep 17 00:00:00 2001 From: Waffle Date: Wed, 6 Nov 2019 23:49:56 +0300 Subject: [PATCH] Rename `Method::METHOD` => `NAME`, `DynMethod::method` => `name` --- src/requests/dynamic.rs | 2 +- src/requests/json.rs | 2 +- src/requests/mod.rs | 8 ++++---- src/requests/multipart.rs | 2 +- src/requests/payloads/get_me.rs | 2 +- src/requests/payloads/get_updates.rs | 2 +- src/requests/payloads/send_animation.rs | 2 +- src/requests/payloads/send_message.rs | 2 +- src/requests/simple.rs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/requests/dynamic.rs b/src/requests/dynamic.rs index 74cc8e38..773f84f5 100644 --- a/src/requests/dynamic.rs +++ b/src/requests/dynamic.rs @@ -50,7 +50,7 @@ where network::request_dynamic( self.bot.client(), self.bot.token(), - self.payload.method(), + self.payload.name(), self.payload.kind(), ).await } diff --git a/src/requests/json.rs b/src/requests/json.rs index cb6b73d5..fc5bcc7b 100644 --- a/src/requests/json.rs +++ b/src/requests/json.rs @@ -34,7 +34,7 @@ where network::request_json( self.bot.client(), self.bot.token(), - P::METHOD, + P::NAME, &self.payload, ).await } diff --git a/src/requests/mod.rs b/src/requests/mod.rs index e34494d4..2192bc24 100644 --- a/src/requests/mod.rs +++ b/src/requests/mod.rs @@ -28,7 +28,7 @@ pub trait Method { type Output; /// Name of the method. - const METHOD: &'static str; + const NAME: &'static str; } /// Signature of telegram method. @@ -39,7 +39,7 @@ pub trait DynMethod { type Output; /// Return name of the method. - fn method(&self) -> &str; + fn name(&self) -> &str; } impl DynMethod for T @@ -48,8 +48,8 @@ where { type Output = T::Output; - fn method(&self) -> &str { - T::METHOD + fn name(&self) -> &str { + T::NAME } } diff --git a/src/requests/multipart.rs b/src/requests/multipart.rs index 5bb123fe..b1ca1155 100644 --- a/src/requests/multipart.rs +++ b/src/requests/multipart.rs @@ -36,7 +36,7 @@ where network::request_multipart( self.bot.client(), self.bot.token(), - P::METHOD, + P::NAME, self.payload.payload(), ).await } diff --git a/src/requests/payloads/get_me.rs b/src/requests/payloads/get_me.rs index 63dfdb88..386ed552 100644 --- a/src/requests/payloads/get_me.rs +++ b/src/requests/payloads/get_me.rs @@ -13,7 +13,7 @@ pub struct GetMe; impl Method for GetMe { type Output = User; - const METHOD: &'static str = "getMe"; + const NAME: &'static str = "getMe"; } impl dynamic::Payload for GetMe { diff --git a/src/requests/payloads/get_updates.rs b/src/requests/payloads/get_updates.rs index 3f6fb949..9e7c12e1 100644 --- a/src/requests/payloads/get_updates.rs +++ b/src/requests/payloads/get_updates.rs @@ -74,7 +74,7 @@ pub enum AllowedUpdate { impl Method for GetUpdates { type Output = Vec; - const METHOD: &'static str = "getUpdates"; + const NAME: &'static str = "getUpdates"; } impl json::Payload for GetUpdates {} diff --git a/src/requests/payloads/send_animation.rs b/src/requests/payloads/send_animation.rs index 60bf4224..f74484ab 100644 --- a/src/requests/payloads/send_animation.rs +++ b/src/requests/payloads/send_animation.rs @@ -58,7 +58,7 @@ pub struct SendAnimation { impl Method for SendAnimation { type Output = Message; - const METHOD: &'static str = "sendAnimation"; + const NAME: &'static str = "sendAnimation"; } impl multipart::Payload for SendAnimation { diff --git a/src/requests/payloads/send_message.rs b/src/requests/payloads/send_message.rs index 895be4f6..ef65e57c 100644 --- a/src/requests/payloads/send_message.rs +++ b/src/requests/payloads/send_message.rs @@ -39,7 +39,7 @@ pub struct SendMessage { impl Method for SendMessage { type Output = Message; - const METHOD: &'static str = "sendMessage"; + const NAME: &'static str = "sendMessage"; } impl json::Payload for SendMessage {} diff --git a/src/requests/simple.rs b/src/requests/simple.rs index f30f8dc9..0f7e3a66 100644 --- a/src/requests/simple.rs +++ b/src/requests/simple.rs @@ -32,7 +32,7 @@ where network::request_simple( self.bot.client(), self.bot.token(), - M::METHOD, + M::NAME, ).await } }