I'm too lazy to amend commits...
This commit is contained in:
Maybe Waffle 2022-09-23 18:40:54 +04:00
parent 0dc459ffcc
commit c96e46dc6c
6 changed files with 19 additions and 14 deletions

View file

@ -13,8 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.parse::<i64>()?, .parse::<i64>()?,
); );
let bot = Bot::from_env() let bot = Bot::from_env().parse_mode(ParseMode::MarkdownV2);
.parse_mode(ParseMode::MarkdownV2);
let Me { user: me, .. } = bot.get_me().await?; let Me { user: me, .. } = bot.get_me().await?;

View file

@ -5,13 +5,16 @@
//! //!
//! [`Requester`]: crate::requests::Requester //! [`Requester`]: crate::requests::Requester
/// [`AutoSend`] bot adaptor which used to allow sending a request without calling /// [`AutoSend`] bot adaptor which used to allow sending a request without
/// [`send`]. /// calling [`send`].
/// ///
/// [`AutoSend`]: auto_send::AutoSend /// [`AutoSend`]: auto_send::AutoSend
/// [`send`]: crate::requests::Request::send /// [`send`]: crate::requests::Request::send
#[cfg(feature = "auto_send")] #[cfg(feature = "auto_send")]
#[deprecated(since = "0.8.0", note = "`AutoSend` is no longer required to `.await` requests and is now noop")] #[deprecated(
since = "0.8.0",
note = "`AutoSend` is no longer required to `.await` requests and is now noop"
)]
pub mod auto_send; pub mod auto_send;
/// [`CacheMe`] bot adaptor which caches [`GetMe`] requests. /// [`CacheMe`] bot adaptor which caches [`GetMe`] requests.

View file

@ -12,10 +12,10 @@ use crate::{
/// Before addition of [`IntoFuture`] you could only `.await` [`Future`]s. /// Before addition of [`IntoFuture`] you could only `.await` [`Future`]s.
/// This adaptor turned requests into futures, allowing to `.await` them, /// This adaptor turned requests into futures, allowing to `.await` them,
/// without calling `.send()`. /// without calling `.send()`.
/// ///
/// Now, however, all requests are required to implement `IntoFuture`, allowing /// Now, however, all requests are required to implement `IntoFuture`, allowing
/// you to `.await` them directly. This adaptor is noop, and shouldn't be used. /// you to `.await` them directly. This adaptor is noop, and shouldn't be used.
/// ///
/// [`Future`]: std::future::Future /// [`Future`]: std::future::Future
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct AutoSend<B> { pub struct AutoSend<B> {

View file

@ -1,5 +1,4 @@
use std::{pin::Pin, sync::Arc}; use std::{future::IntoFuture, pin::Pin, sync::Arc};
use std::future::IntoFuture;
use futures::{ use futures::{
future, future,

View file

@ -41,7 +41,7 @@ where
/// Send this request. /// Send this request.
/// ///
/// ## Examples /// ## Examples
/// ///
/// ``` /// ```
/// # async { /// # async {
/// use teloxide_core::{ /// use teloxide_core::{
@ -57,7 +57,7 @@ where
/// let method = GetMe::new(); /// let method = GetMe::new();
/// let request = JsonRequest::new(bot, method); /// let request = JsonRequest::new(bot, method);
/// let _: Me = request.send().await.unwrap(); /// let _: Me = request.send().await.unwrap();
/// ///
/// // You can also just await requests, without calling `send`: /// // You can also just await requests, without calling `send`:
/// let method = GetMe::new(); /// let method = GetMe::new();
/// let request = JsonRequest::new(bot, method); /// let request = JsonRequest::new(bot, method);
@ -78,7 +78,7 @@ where
/// and then serializing it, this method should just serialize the data.) /// and then serializing it, this method should just serialize the data.)
/// ///
/// ## Examples /// ## Examples
/// ///
/// ``` /// ```
/// # async { /// # async {
/// use teloxide_core::{prelude::*, requests::Request, types::ChatId, Bot}; /// use teloxide_core::{prelude::*, requests::Request, types::ChatId, Bot};
@ -105,7 +105,8 @@ where
} }
} }
// FIXME: re-introduce `Either` impls once `Either: IntoFuture` (or make out own `Either`) (same for `Requester`) // FIXME: re-introduce `Either` impls once `Either: IntoFuture` (or make out own
// `Either`) (same for `Requester`)
// impl<L, R> Request for Either<L, R> // impl<L, R> Request for Either<L, R>
// where // where

View file

@ -29,7 +29,10 @@ pub trait RequesterExt: Requester {
/// Send requests automatically, see [`AutoSend`] for more. /// Send requests automatically, see [`AutoSend`] for more.
#[cfg(feature = "auto_send")] #[cfg(feature = "auto_send")]
#[deprecated(since = "0.8.0", note = "`AutoSend` is no longer required to `.await` requests and is now noop")] #[deprecated(
since = "0.8.0",
note = "`AutoSend` is no longer required to `.await` requests and is now noop"
)]
#[allow(deprecated)] #[allow(deprecated)]
fn auto_send(self) -> AutoSend<Self> fn auto_send(self) -> AutoSend<Self>
where where