mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Remove async move { /* only one future*/.await }
This commit is contained in:
parent
b0d88d69ea
commit
94c5320ca8
3 changed files with 20 additions and 18 deletions
|
@ -28,14 +28,14 @@ impl<'a> Request<'a> for ForwardMessage<'a> {
|
||||||
type ReturnValue = Message;
|
type ReturnValue = Message;
|
||||||
|
|
||||||
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
||||||
Box::pin(async move {
|
Box::pin(
|
||||||
network::request_json(
|
network::request_json(
|
||||||
&self.ctx.client,
|
self.ctx.client,
|
||||||
&self.ctx.token,
|
self.ctx.token,
|
||||||
"forwardMessage",
|
"forwardMessage",
|
||||||
&self,
|
&self,
|
||||||
).await
|
)
|
||||||
})
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,22 +8,26 @@ use crate::core::types::User;
|
||||||
/// A simple method for testing your bot's auth token. Requires no parameters.
|
/// A simple method for testing your bot's auth token. Requires no parameters.
|
||||||
/// Returns basic information about the bot in form of a [`User`] object.
|
/// Returns basic information about the bot in form of a [`User`] object.
|
||||||
pub struct GetMe<'a> {
|
pub struct GetMe<'a> {
|
||||||
info: RequestContext<'a>,
|
ctx: RequestContext<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Request<'a> for GetMe<'a> {
|
impl<'a> Request<'a> for GetMe<'a> {
|
||||||
type ReturnValue = User;
|
type ReturnValue = User;
|
||||||
|
|
||||||
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
||||||
Box::pin(async move {
|
Box::pin(
|
||||||
network::request_multipart(self.info.client, self.info.token, "getMe", None)
|
network::request_multipart(
|
||||||
.await
|
self.ctx.client,
|
||||||
})
|
self.ctx.token,
|
||||||
|
"getMe",
|
||||||
|
None
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> GetMe<'a> {
|
impl<'a> GetMe<'a> {
|
||||||
pub(crate) fn new(info: RequestContext<'a>) -> Self {
|
pub(crate) fn new(ctx: RequestContext<'a>) -> Self {
|
||||||
GetMe { info }
|
GetMe { ctx }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ use crate::core::requests::form_builder::FormBuilder;
|
||||||
use crate::core::requests::{
|
use crate::core::requests::{
|
||||||
ChatId, Request, RequestFuture, RequestContext, ResponseResult,
|
ChatId, Request, RequestFuture, RequestContext, ResponseResult,
|
||||||
};
|
};
|
||||||
use crate::core::{network, types::Message, types::ParseMode};
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
|
@ -44,15 +43,14 @@ impl<'a> Request<'a> for SendMessage<'a> {
|
||||||
type ReturnValue = Message;
|
type ReturnValue = Message;
|
||||||
|
|
||||||
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
|
||||||
Box::pin(async move {
|
Box::pin(
|
||||||
network::request_json(
|
network::request_json(
|
||||||
&self.ctx.client,
|
self.ctx.client,
|
||||||
&self.ctx.token,
|
self.ctx.token,
|
||||||
"sendMessage",
|
"sendMessage",
|
||||||
&self,
|
&self,
|
||||||
)
|
)
|
||||||
.await
|
)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue