Rename Method::METHOD => NAME, DynMethod::method => name

This commit is contained in:
Waffle 2019-11-06 23:49:56 +03:00
parent c0953893b5
commit 5f86362f17
9 changed files with 12 additions and 12 deletions

View file

@ -50,7 +50,7 @@ where
network::request_dynamic( network::request_dynamic(
self.bot.client(), self.bot.client(),
self.bot.token(), self.bot.token(),
self.payload.method(), self.payload.name(),
self.payload.kind(), self.payload.kind(),
).await ).await
} }

View file

@ -34,7 +34,7 @@ where
network::request_json( network::request_json(
self.bot.client(), self.bot.client(),
self.bot.token(), self.bot.token(),
P::METHOD, P::NAME,
&self.payload, &self.payload,
).await ).await
} }

View file

@ -28,7 +28,7 @@ pub trait Method {
type Output; type Output;
/// Name of the method. /// Name of the method.
const METHOD: &'static str; const NAME: &'static str;
} }
/// Signature of telegram method. /// Signature of telegram method.
@ -39,7 +39,7 @@ pub trait DynMethod {
type Output; type Output;
/// Return name of the method. /// Return name of the method.
fn method(&self) -> &str; fn name(&self) -> &str;
} }
impl<T> DynMethod for T impl<T> DynMethod for T
@ -48,8 +48,8 @@ where
{ {
type Output = T::Output; type Output = T::Output;
fn method(&self) -> &str { fn name(&self) -> &str {
T::METHOD T::NAME
} }
} }

View file

@ -36,7 +36,7 @@ where
network::request_multipart( network::request_multipart(
self.bot.client(), self.bot.client(),
self.bot.token(), self.bot.token(),
P::METHOD, P::NAME,
self.payload.payload(), self.payload.payload(),
).await ).await
} }

View file

@ -13,7 +13,7 @@ pub struct GetMe;
impl Method for GetMe { impl Method for GetMe {
type Output = User; type Output = User;
const METHOD: &'static str = "getMe"; const NAME: &'static str = "getMe";
} }
impl dynamic::Payload for GetMe { impl dynamic::Payload for GetMe {

View file

@ -74,7 +74,7 @@ pub enum AllowedUpdate {
impl Method for GetUpdates { impl Method for GetUpdates {
type Output = Vec<Update>; type Output = Vec<Update>;
const METHOD: &'static str = "getUpdates"; const NAME: &'static str = "getUpdates";
} }
impl json::Payload for GetUpdates {} impl json::Payload for GetUpdates {}

View file

@ -58,7 +58,7 @@ pub struct SendAnimation {
impl Method for SendAnimation { impl Method for SendAnimation {
type Output = Message; type Output = Message;
const METHOD: &'static str = "sendAnimation"; const NAME: &'static str = "sendAnimation";
} }
impl multipart::Payload for SendAnimation { impl multipart::Payload for SendAnimation {

View file

@ -39,7 +39,7 @@ pub struct SendMessage {
impl Method for SendMessage { impl Method for SendMessage {
type Output = Message; type Output = Message;
const METHOD: &'static str = "sendMessage"; const NAME: &'static str = "sendMessage";
} }
impl json::Payload for SendMessage {} impl json::Payload for SendMessage {}

View file

@ -32,7 +32,7 @@ where
network::request_simple( network::request_simple(
self.bot.client(), self.bot.client(),
self.bot.token(), self.bot.token(),
M::METHOD, M::NAME,
).await ).await
} }
} }