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(
self.bot.client(),
self.bot.token(),
self.payload.method(),
self.payload.name(),
self.payload.kind(),
).await
}

View file

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

View file

@ -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<T> DynMethod for T
@ -48,8 +48,8 @@ where
{
type Output = T::Output;
fn method(&self) -> &str {
T::METHOD
fn name(&self) -> &str {
T::NAME
}
}

View file

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

View file

@ -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 {

View file

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

View file

@ -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 {

View file

@ -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 {}

View file

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