diff --git a/src/adaptors.rs b/src/adaptors.rs index 40982784..fc4c6583 100644 --- a/src/adaptors.rs +++ b/src/adaptors.rs @@ -1,11 +1,10 @@ -//! ## Bot adaptors +//! Wrappers altering functionality of a bot. //! -//! Bot adaptors are very similar to [`Iterator`] adaptors — -//! they are bots (implement [`Requester`]) which wrap other bots -//! adding new functionality. +//! Bot adaptors are very similar to the [`Iterator`] adaptors: they are bots +//! wrapping other bots to alter existing or add new functionality. //! -//! E.g. [`AutoSend`] allows `await`ing requests directly, -//! without need to use `.send()`. +//! E.g. [`AutoSend`] allows `await`ing requests directly, no need to to use +//! `.send()`. //! //! [`Requester`]: crate::requests::Requester diff --git a/src/adaptors/parse_mode.rs b/src/adaptors/parse_mode.rs index ce4814d9..5057a5f1 100644 --- a/src/adaptors/parse_mode.rs +++ b/src/adaptors/parse_mode.rs @@ -5,14 +5,14 @@ use crate::{ }; /// Default parse mode adaptor, see -/// [`RequesterExt::parse_mode`](crate::requests::RequesterExt::parse_mode) +/// [`RequesterExt::parse_mode`](crate::requests::RequesterExt::parse_mode). pub struct DefaultParseMode { bot: B, mode: ParseMode, } impl DefaultParseMode { - /// Creates new [`DefaultParseMode`] + /// Creates new [`DefaultParseMode`]. /// /// Note: it's recommended to use [`RequesterExt::parse_mode`] instead. /// @@ -21,12 +21,12 @@ impl DefaultParseMode { Self { bot, mode: parse_mode } } - /// Allows to access inner bot + /// Allows to access the inner bot. pub fn inner(&self) -> &B { &self.bot } - /// Unwraps inner bot + /// Unwraps the inner bot. pub fn into_inner(self) -> B { self.bot } diff --git a/src/errors.rs b/src/errors.rs index 1164398a..1b183180 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -8,11 +8,11 @@ use thiserror::Error; /// An error caused by downloading a file. #[derive(Debug, Error, From)] pub enum DownloadError { - /// Network error while downloading file from telegram. + /// Network error while downloading a file from Telegram. #[error("A network error: {0}")] NetworkError(#[source] reqwest::Error), - /// I/O error while writing file to destination. + /// An I/O error while writing a file to destination. #[error("An I/O error: {0}")] Io(#[source] std::io::Error), } @@ -20,12 +20,13 @@ pub enum DownloadError { /// An error caused by sending a request to Telegram. #[derive(Debug, Error)] pub enum RequestError { - /// Telegram API error + /// Telegram API error. #[error("A Telegram's error #{status_code}: {kind:?}")] ApiError { - /// Kind of api error + /// Kind of an API error. kind: ApiError, - /// HTTP code returned by telegram, not very usefull in practice. + + /// An HTTP code returned by Telegram, not very useful in practice. status_code: StatusCode, }, @@ -39,11 +40,11 @@ pub enum RequestError { #[error("Retry after {0} seconds")] RetryAfter(i32), - /// Network error while sending request to telegram. + /// Network error while sending a request to Telegram. #[error("A network error: {0}")] NetworkError(#[source] reqwest::Error), - /// Error while parsing response from telegram. + /// Error while parsing a response from Telegram. /// /// If you've received this error, please, [open an issue] with the /// description of the error. diff --git a/src/net/download.rs b/src/net/download.rs index 16694821..5c123cb7 100644 --- a/src/net/download.rs +++ b/src/net/download.rs @@ -11,17 +11,15 @@ use tokio::io::{AsyncWrite, AsyncWriteExt}; use crate::{errors::DownloadError, net::file_url}; -/// Download client. -/// -/// This trait allows you to download files from telegram. +/// A trait for downloading files from Telegram. pub trait Download<'w> /* FIXME(waffle): ideally, this lifetime ('w) shouldn't be here, but we can't help it without * GATs */ { - /// Error returned by [`download_file`](Self::download_file) + /// An error returned from [`download_file`](Self::download_file). type Err; - /// Future returned from [`download_file`](Self::download_file) + /// A future returned from [`download_file`](Self::download_file). type Fut: Future> + Send; /// Download a file from Telegram into `destination`. @@ -58,15 +56,16 @@ pub trait Download<'w> destination: &'w mut (dyn AsyncWrite + Unpin + Send), ) -> Self::Fut; - /// Error returned by [`download_file_stream`](Self::download_file_stream) + /// An error returned from + /// [`download_file_stream`](Self::download_file_stream). type StreamErr; - /// Stream returned from [`download_file_stream`] + /// A stream returned from [`download_file_stream`]. /// ///[`download_file_stream`]: (Self::download_file_stream) type Stream: Stream> + Send; - /// Download a file from Telegram as a [`Stream`]. + /// Download a file from Telegram as [`Stream`]. /// /// `path` can be obtained from the [`GetFile`]. /// @@ -84,7 +83,7 @@ pub trait Download<'w> /// /// Note: if you don't need to use a different (from you're bot) client and /// don't need to get *all* performance (and you don't, c'mon it's very io-bound -/// job), then it's recommended to use [`Download::download_file`] +/// job), then it's recommended to use [`Download::download_file`]. pub fn download_file<'o, D>( client: &Client, api_url: Url, @@ -106,11 +105,11 @@ where }) } -/// Download a file from Telegram as a [`Stream`]. +/// Download a file from Telegram as [`Stream`]. /// /// Note: if you don't need to use a different (from you're bot) client and /// don't need to get *all* performance (and you don't, c'mon it's very io-bound -/// job), then it's recommended to use [`Download::download_file_stream`] +/// job), then it's recommended to use [`Download::download_file_stream`]. pub fn download_file_stream( client: &Client, api_url: Url, diff --git a/src/net/mod.rs b/src/net/mod.rs index cac0f366..119213aa 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -1,8 +1,4 @@ -//! Network specific items. -//! -//! Currently this module contains only the file download stuff and the default -//! api url. -// ... and some internal stuff :P +//! Network-specific API. pub use self::download::{download_file, download_file_stream, Download}; @@ -15,7 +11,7 @@ mod download; mod request; mod telegram_response; -/// Default telegram api url +/// The default Telegram API URL. pub const TELEGRAM_API_URL: &str = "https://api.telegram.org"; /// Creates URL for making HTTPS requests. See the [Telegram documentation]. diff --git a/src/payloads/mod.rs b/src/payloads/mod.rs index 171588be..42b90fe7 100644 --- a/src/payloads/mod.rs +++ b/src/payloads/mod.rs @@ -1,11 +1,14 @@ -//! Payloads - data types sended to relegram +//! Request data sent to Telegram. -/// This module reexports all setters traits as `_`. When used with a glob +/// This module re-exports all the setters traits as `_`. When used with a glob /// import: +/// /// ``` /// use teloxide_core::payloads::setters::*; /// ``` -/// It allows you to use all payloads setters, without polluting your namespace. +/// +/// It allows you to use all the payloads setters, without polluting your +/// namespace. pub mod setters; // This block is auto generated by `cg` (878e847). diff --git a/src/prelude.rs b/src/prelude.rs index 886b201a..3ea2b60c 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,3 +1,3 @@ -//! Crate prelude +//! Commonly used items. pub use crate::requests::Requester; diff --git a/src/requests/has_payload.rs b/src/requests/has_payload.rs index facca0cc..6c0c1abf 100644 --- a/src/requests/has_payload.rs +++ b/src/requests/has_payload.rs @@ -1,15 +1,14 @@ use crate::requests::Payload; -/// Represent types that have payload inside it. E.g.: the payload itself or a -/// `Request`. +/// Represents types having payload inside. /// /// This trait is something between [`DerefMut`] and [`BorrowMut`] — it allows -/// only one implementation per type (the [output] is associated type, not a -/// generic), have implementations for all types `P` such `P: `[`Payload`], but -/// have no magic compiler support like [`DerefMut`] does nor does it require +/// only one implementation per type (the [output type] is associated, not +/// generic), has implementations for all types `P` such `P: `[`Payload`], but +/// has no magic compiler support like [`DerefMut`] does nor does it require /// any laws about `Eq`, `Ord` and `Hash` as [`BorrowMut`] does. /// -/// Also [output] type is bounded by [`Payload`] trait. +/// Also the [output type] is bounded by the [`Payload`] trait. /// /// This trait is mostly used to implement payload setters (on both payloads & /// requests), so you probably won't find yourself using it directly. @@ -17,13 +16,13 @@ use crate::requests::Payload; /// [`DerefMut`]: std::ops::DerefMut /// [`BorrowMut`]: std::borrow::BorrowMut /// [`Payload`]: crate::requests::Payload -/// [output]: HasPayload::Payload +/// [output type]: HasPayload::Payload pub trait HasPayload // FIXME(waffle): // we wanted to use As{Mut,Ref} here, but they doesn't work // because of https://github.com/rust-lang/rust/issues/77010 { - /// Type of the payload contained. + /// A type of the payload contained. type Payload: Payload; /// Gain mutable access to the underlying payload. diff --git a/src/requests/json.rs b/src/requests/json.rs index 51cf906a..bda409e5 100644 --- a/src/requests/json.rs +++ b/src/requests/json.rs @@ -6,11 +6,9 @@ use crate::{ RequestError, }; -/// Ready-to-send telegram request. +/// A ready-to-send Telegram request whose payload is sent using [JSON]. /// -/// Note: payload will be sent to telegram using [`json`] -/// -/// [`json`]: https://core.telegram.org/bots/api#making-requests +/// [JSON]: https://core.telegram.org/bots/api#making-requests #[must_use = "requests do nothing until sent"] pub struct JsonRequest

{ bot: Bot, diff --git a/src/requests/mod.rs b/src/requests/mod.rs index 3433c81e..84e933e6 100644 --- a/src/requests/mod.rs +++ b/src/requests/mod.rs @@ -8,8 +8,7 @@ pub use self::{ /// A type that is returned after making a request to Telegram. pub type ResponseResult = Result; -/// Output of a [`Payload`] in [`HasPayload`]. Alias to -/// `<::Payload as Payload>::Output`. +/// An output type of [`Payload`] in [`HasPayload`]. pub type Output = <::Payload as Payload>::Output; mod has_payload; diff --git a/src/requests/multipart.rs b/src/requests/multipart.rs index 41339055..5b2ea867 100644 --- a/src/requests/multipart.rs +++ b/src/requests/multipart.rs @@ -6,11 +6,10 @@ use crate::{ RequestError, }; -/// Ready-to-send telegram request. +/// A ready-to-send Telegram request whose payload is sent using +/// [multipart/form-data]. /// -/// Note: payload will be sent to telegram using [`multipart/form-data`] -/// -/// [`multipart/form-data`]: https://core.telegram.org/bots/api#making-requests +/// [multipart/form-data]: https://core.telegram.org/bots/api#making-requests #[must_use = "requests do nothing until sent"] pub struct MultipartRequest

{ bot: Bot, diff --git a/src/requests/payload.rs b/src/requests/payload.rs index 0e02531d..8b885e96 100644 --- a/src/requests/payload.rs +++ b/src/requests/payload.rs @@ -1,20 +1,24 @@ /// Payload of a request. /// -/// Simply speaking structs implementing this trait represent arguments of -/// a telegram bot API method. +/// Simply speaking, structures implementing this trait represent arguments of +/// a Telegram bot API method. /// -/// This trait provides some additional information needed for sending request -/// to the telegram. +/// Also, this trait provides some additional information needed for sending a +/// request to Telegram. #[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))] pub trait Payload { - /// Return type of the telegram method. + /// A return type of a Telegram method. /// - /// Note: that should not include result wrappers (e.g. it should be simply - /// `Message`, `True` or something else) + /// Note: it should not include `Result` wrappers (e.g. it should be simply + /// [`Message`], [`True`] or something else). + /// + /// [`Message`]: crate::types::Message + /// [`True`]: crate::types::True type Output; - /// Name of the telegram method. Case insensitive, though must not include - /// underscores. (e.g.: `GetMe`, `GETME`, `getme`, `getMe` are ok, but - /// `get_me` is not ok) + /// Name of a Telegram method. + /// + /// It is case insensitive, though must not include underscores. (e.g. + /// `GetMe`, `GETME`, `getme`, `getMe` are ok, but `get_me` is not ok). const NAME: &'static str; } diff --git a/src/requests/request.rs b/src/requests/request.rs index 0d6692d9..b3f674f3 100644 --- a/src/requests/request.rs +++ b/src/requests/request.rs @@ -2,7 +2,7 @@ use std::future::Future; use crate::requests::{HasPayload, Output}; -/// A ready-to-send telegram request. +/// A ready-to-send Telegram request. // FIXME(waffle): Write better doc for the trait /// /// ## Implementation notes @@ -23,19 +23,20 @@ pub trait Request: HasPayload { * use it before it's integrated in async/await */ - /// Type of error that may happen during sending the request to telegram. + /// A type of an error that may happen while sending a request to Telegram. type Err: std::error::Error + Send; - /// Type of future returned by [`send`](Request::send) method. + /// A type of the future returned by the [`send`](Request::send) method. type Send: Future, Self::Err>> + Send; - /// Type of future returned by [`send_ref`](Request::send_ref) method. + /// A type of the future returned by the [`send_ref`](Request::send_ref) + /// method. /// - /// NOTE: it intentionally forbids borrowing from self - // though anyway we couldn't allow borrowing without GATs :sob: + /// Note: it intentionally forbids borrowing from `self` though anyway we + /// couldn't allow borrowing without GATs. type SendRef: Future, Self::Err>> + Send; - /// Send the request. + /// Send this request. /// /// ## Examples // FIXME(waffle): ignored until full request redesign lands @@ -51,15 +52,15 @@ pub trait Request: HasPayload { /// ``` fn send(self) -> Self::Send; - /// Send the request. + /// Send this request by reference. /// /// This method is analogous to [`send`](Request::send), but it doesn't take /// the ownership of `self`. This allows to send the same (or slightly /// different) requests over and over. /// - /// _Also_ it is expected that calling this method is better than just - /// `clone`ing the requests. (because instead of copying all the data - /// and then serializing it, this method should just serialize the data) + /// Also, it is expected that calling this method is better than just + /// cloning requests. (Because instead of copying all the data + /// and then serializing it, this method should just serialize the data.) /// /// ## Examples // FIXME(waffle): ignored until full request redesign lands diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 5352ab35..87a78331 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -8,8 +8,9 @@ use crate::{ }, }; -/// The trait implemented by all bots & bot adaptors. -/// Essentially a request builder factory (?). +/// Methods for building requests. +/// +/// This trait is implemented by all bots & bot adaptors. /// /// _This trait is included in the crate's [`prelude`](crate::prelude)_. #[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))] @@ -22,12 +23,12 @@ pub trait Requester { type GetUpdates: Request; - /// For telegram documentation see [`GetUpdates`] + /// For Telegram documentation see [`GetUpdates`]. fn get_updates(&self) -> Self::GetUpdates; type SetWebhook: Request; - /// For telegram documentation see [`SetWebhook`] + /// For Telegram documentation see [`SetWebhook`]. fn set_webhook(&self, url: U, allowed_updates: A) -> Self::SetWebhook where U: Into, @@ -35,22 +36,22 @@ pub trait Requester { type DeleteWebhook: Request; - /// For telegram documentation see [`DeleteWebhook`] + /// For Telegram documentation see [`DeleteWebhook`]. fn delete_webhook(&self) -> Self::DeleteWebhook; type GetWebhookInfo: Request; - /// For telegram documentation see [`GetWebhookInfo`] + /// For Telegram documentation see [`GetWebhookInfo`]. fn get_webhook_info(&self) -> Self::GetWebhookInfo; type GetMe: Request; - /// For telegram documentation see [`GetMe`] + /// For Telegram documentation see [`GetMe`]. fn get_me(&self) -> Self::GetMe; type SendMessage: Request; - /// For telegram documentation see [`SendMessage`] + /// For Telegram documentation see [`SendMessage`]. fn send_message(&self, chat_id: C, text: T) -> Self::SendMessage where C: Into, @@ -58,7 +59,7 @@ pub trait Requester { type ForwardMessage: Request; - /// For telegram documentation see [`ForwardMessage`] + /// For Telegram documentation see [`ForwardMessage`]. fn forward_message( &self, chat_id: C, @@ -71,7 +72,7 @@ pub trait Requester { type SendPhoto: Request; - /// For telegram documentation see [`SendPhoto`] + /// For Telegram documentation see [`SendPhoto`]. fn send_photo(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto where Ch: Into, @@ -79,7 +80,7 @@ pub trait Requester { type SendAudio: Request; - /// For telegram documentation see [`SendAudio`] + /// For Telegram documentation see [`SendAudio`]. fn send_audio(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio where Ch: Into, @@ -87,7 +88,7 @@ pub trait Requester { type SendDocument: Request; - /// For telegram documentation see [`SendDocument`] + /// For Telegram documentation see [`SendDocument`]. fn send_document( &self, chat_id: Ch, @@ -100,7 +101,7 @@ pub trait Requester { type SendVideo: Request; - /// For telegram documentation see [`SendVideo`] + /// For Telegram documentation see [`SendVideo`]. fn send_video(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo where Ch: Into, @@ -108,7 +109,7 @@ pub trait Requester { type SendAnimation: Request; - /// For telegram documentation see [`SendAnimation`] + /// For Telegram documentation see [`SendAnimation`]. fn send_animation( &self, chat_id: Ch, @@ -121,7 +122,7 @@ pub trait Requester { type SendVoice: Request; - /// For telegram documentation see [`SendVoice`] + /// For Telegram documentation see [`SendVoice`]. fn send_voice(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice where Ch: Into, @@ -129,14 +130,14 @@ pub trait Requester { type SendVideoNote: Request; - /// For telegram documentation see [`SendVideoNote`] + /// For Telegram documentation see [`SendVideoNote`]. fn send_video_note(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote where C: Into; type SendMediaGroup: Request; - /// For telegram documentation see [`SendMediaGroup`] + /// For Telegram documentation see [`SendMediaGroup`]. fn send_media_group(&self, chat_id: C, media: M) -> Self::SendMediaGroup where C: Into, @@ -144,7 +145,7 @@ pub trait Requester { type SendLocation: Request; - /// For telegram documentation see [`SendLocation`] + /// For Telegram documentation see [`SendLocation`]. fn send_location( &self, chat_id: C, @@ -157,7 +158,7 @@ pub trait Requester { type EditMessageLiveLocation: Request; - /// For telegram documentation see [`EditMessageLiveLocation`] + /// For Telegram documentation see [`EditMessageLiveLocation`]. fn edit_message_live_location( &self, chat_id: C, @@ -173,7 +174,7 @@ pub trait Requester { Err = Self::Err, >; - /// For telegram documentation see [`EditMessageLiveLocationInline`] + /// For Telegram documentation see [`EditMessageLiveLocationInline`]. fn edit_message_live_location_inline( &self, inline_message_id: I, @@ -185,7 +186,7 @@ pub trait Requester { type StopMessageLiveLocation: Request; - /// For telegram documentation see [`StopMessageLiveLocation`] + /// For Telegram documentation see [`StopMessageLiveLocation`]. fn stop_message_live_location( &self, chat_id: C, @@ -201,7 +202,7 @@ pub trait Requester { Err = Self::Err, >; - /// For telegram documentation see [`StopMessageLiveLocationInline`] + /// For Telegram documentation see [`StopMessageLiveLocationInline`]. fn stop_message_live_location_inline( &self, inline_message_id: I, @@ -213,7 +214,7 @@ pub trait Requester { type SendVenue: Request; - /// For telegram documentation see [`SendVenue`] + /// For Telegram documentation see [`SendVenue`]. fn send_venue( &self, chat_id: C, @@ -229,14 +230,14 @@ pub trait Requester { type SendContact: Request; - /// For telegram documentation see [`SendContact`] + /// For Telegram documentation see [`SendContact`]. fn send_contact(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact where C: Into; type SendPoll: Request; - /// For telegram documentation see [`SendPoll`] + /// For Telegram documentation see [`SendPoll`]. fn send_poll( &self, chat_id: C, @@ -251,47 +252,47 @@ pub trait Requester { type SendDice: Request; - /// For telegram documentation see [`SendDice`] + /// For Telegram documentation see [`SendDice`]. fn send_dice(&self, chat_id: C, emoji: DiceEmoji) -> Self::SendDice where C: Into; type SendChatAction: Request; - /// For telegram documentation see [`SendChatAction`] + /// For Telegram documentation see [`SendChatAction`]. fn send_chat_action(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction where C: Into; type GetUserProfilePhotos: Request; - /// For telegram documentation see [`GetUserProfilePhotos`] + /// For Telegram documentation see [`GetUserProfilePhotos`]. fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos; type GetFile: Request; - /// For telegram documentation see [`GetFile`] + /// For Telegram documentation see [`GetFile`]. fn get_file(&self, file_id: F) -> Self::GetFile where F: Into; type KickChatMember: Request; - /// For telegram documentation see [`KickChatMember`] + /// For Telegram documentation see [`KickChatMember`]. fn kick_chat_member(&self, chat_id: C, user_id: i32) -> Self::KickChatMember where C: Into; type UnbanChatMember: Request; - /// For telegram documentation see [`UnbanChatMember`] + /// For Telegram documentation see [`UnbanChatMember`]. fn unban_chat_member(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember where C: Into; type RestrictChatMember: Request; - /// For telegram documentation see [`RestrictChatMember`] + /// For Telegram documentation see [`RestrictChatMember`]. fn restrict_chat_member( &self, chat_id: C, @@ -303,7 +304,7 @@ pub trait Requester { type PromoteChatMember: Request; - /// For telegram documentation see [`PromoteChatMember`] + /// For Telegram documentation see [`PromoteChatMember`]. fn promote_chat_member(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember where C: Into; @@ -313,7 +314,7 @@ pub trait Requester { Err = Self::Err, >; - /// For telegram documentation see [`SetChatAdministratorCustomTitle`] + /// For Telegram documentation see [`SetChatAdministratorCustomTitle`]. fn set_chat_administrator_custom_title( &self, chat_id: Ch, @@ -326,7 +327,7 @@ pub trait Requester { type SetChatPermissions: Request; - /// For telegram documentation see [`SetChatPermissions`] + /// For Telegram documentation see [`SetChatPermissions`]. fn set_chat_permissions( &self, chat_id: C, @@ -337,28 +338,28 @@ pub trait Requester { type ExportChatInviteLink: Request; - /// For telegram documentation see [`ExportChatInviteLink`] + /// For Telegram documentation see [`ExportChatInviteLink`]. fn export_chat_invite_link(&self, chat_id: C) -> Self::ExportChatInviteLink where C: Into; type SetChatPhoto: Request; - /// For telegram documentation see [`SetChatPhoto`] + /// For Telegram documentation see [`SetChatPhoto`]. fn set_chat_photo(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto where C: Into; type DeleteChatPhoto: Request; - /// For telegram documentation see [`DeleteChatPhoto`] + /// For Telegram documentation see [`DeleteChatPhoto`]. fn delete_chat_photo(&self, chat_id: C) -> Self::DeleteChatPhoto where C: Into; type SetChatTitle: Request; - /// For telegram documentation see [`SetChatTitle`] + /// For Telegram documentation see [`SetChatTitle`]. fn set_chat_title(&self, chat_id: C, title: T) -> Self::SetChatTitle where C: Into, @@ -366,63 +367,63 @@ pub trait Requester { type SetChatDescription: Request; - /// For telegram documentation see [`SetChatDescription`] + /// For Telegram documentation see [`SetChatDescription`]. fn set_chat_description(&self, chat_id: C) -> Self::SetChatDescription where C: Into; type PinChatMessage: Request; - /// For telegram documentation see [`PinChatMessage`] + /// For Telegram documentation see [`PinChatMessage`]. fn pin_chat_message(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage where C: Into; type UnpinChatMessage: Request; - /// For telegram documentation see [`UnpinChatMessage`] + /// For Telegram documentation see [`UnpinChatMessage`]. fn unpin_chat_message(&self, chat_id: C) -> Self::UnpinChatMessage where C: Into; type LeaveChat: Request; - /// For telegram documentation see [`LeaveChat`] + /// For Telegram documentation see [`LeaveChat`]. fn leave_chat(&self, chat_id: C) -> Self::LeaveChat where C: Into; type GetChat: Request; - /// For telegram documentation see [`GetChat`] + /// For Telegram documentation see [`GetChat`]. fn get_chat(&self, chat_id: C) -> Self::GetChat where C: Into; type GetChatAdministrators: Request; - /// For telegram documentation see [`GetChatAdministrators`] + /// For Telegram documentation see [`GetChatAdministrators`]. fn get_chat_administrators(&self, chat_id: C) -> Self::GetChatAdministrators where C: Into; type GetChatMembersCount: Request; - /// For telegram documentation see [`GetChatMembersCount`] + /// For Telegram documentation see [`GetChatMembersCount`]. fn get_chat_members_count(&self, chat_id: C) -> Self::GetChatMembersCount where C: Into; type GetChatMember: Request; - /// For telegram documentation see [`GetChatMember`] + /// For Telegram documentation see [`GetChatMember`]. fn get_chat_member(&self, chat_id: C, user_id: i32) -> Self::GetChatMember where C: Into; type SetChatStickerSet: Request; - /// For telegram documentation see [`SetChatStickerSet`] + /// For Telegram documentation see [`SetChatStickerSet`]. fn set_chat_sticker_set( &self, chat_id: C, @@ -434,33 +435,33 @@ pub trait Requester { type DeleteChatStickerSet: Request; - /// For telegram documentation see [`DeleteChatStickerSet`] + /// For Telegram documentation see [`DeleteChatStickerSet`]. fn delete_chat_sticker_set(&self, chat_id: C) -> Self::DeleteChatStickerSet where C: Into; type AnswerCallbackQuery: Request; - /// For telegram documentation see [`AnswerCallbackQuery`] + /// For Telegram documentation see [`AnswerCallbackQuery`]. fn answer_callback_query(&self, callback_query_id: C) -> Self::AnswerCallbackQuery where C: Into; type SetMyCommands: Request; - /// For telegram documentation see [`SetMyCommands`] + /// For Telegram documentation see [`SetMyCommands`]. fn set_my_commands(&self, commands: C) -> Self::SetMyCommands where C: IntoIterator; type GetMyCommands: Request; - /// For telegram documentation see [`GetMyCommands`] + /// For Telegram documentation see [`GetMyCommands`]. fn get_my_commands(&self) -> Self::GetMyCommands; type AnswerInlineQuery: Request; - /// For telegram documentation see [`AnswerInlineQuery`] + /// For Telegram documentation see [`AnswerInlineQuery`]. fn answer_inline_query(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery where I: Into, @@ -468,7 +469,7 @@ pub trait Requester { type EditMessageText: Request; - /// For telegram documentation see [`EditMessageText`] + /// For Telegram documentation see [`EditMessageText`]. fn edit_message_text( &self, chat_id: C, @@ -481,7 +482,7 @@ pub trait Requester { type EditMessageTextInline: Request; - /// For telegram documentation see [`EditMessageTextInline`] + /// For Telegram documentation see [`EditMessageTextInline`]. fn edit_message_text_inline( &self, inline_message_id: I, @@ -493,7 +494,7 @@ pub trait Requester { type EditMessageCaption: Request; - /// For telegram documentation see [`EditMessageCaption`] + /// For Telegram documentation see [`EditMessageCaption`]. fn edit_message_caption( &self, chat_id: Ch, @@ -506,7 +507,7 @@ pub trait Requester { type EditMessageCaptionInline: Request; - /// For telegram documentation see [`EditMessageCaptionInline`] + /// For Telegram documentation see [`EditMessageCaptionInline`]. fn edit_message_caption_inline( &self, inline_message_id: I, @@ -518,7 +519,7 @@ pub trait Requester { type EditMessageMedia: Request; - /// For telegram documentation see [`EditMessageMedia`] + /// For Telegram documentation see [`EditMessageMedia`]. fn edit_message_media( &self, chat_id: C, @@ -530,7 +531,7 @@ pub trait Requester { type EditMessageMediaInline: Request; - /// For telegram documentation see [`EditMessageMediaInline`] + /// For Telegram documentation see [`EditMessageMediaInline`]. fn edit_message_media_inline( &self, inline_message_id: I, @@ -541,7 +542,7 @@ pub trait Requester { type EditMessageReplyMarkup: Request; - /// For telegram documentation see [`EditMessageReplyMarkup`] + /// For Telegram documentation see [`EditMessageReplyMarkup`]. fn edit_message_reply_markup( &self, chat_id: C, @@ -555,7 +556,7 @@ pub trait Requester { Err = Self::Err, >; - /// For telegram documentation see [`EditMessageReplyMarkupInline`] + /// For Telegram documentation see [`EditMessageReplyMarkupInline`]. fn edit_message_reply_markup_inline( &self, inline_message_id: I, @@ -565,40 +566,40 @@ pub trait Requester { type StopPoll: Request; - /// For telegram documentation see [`StopPoll`] + /// For Telegram documentation see [`StopPoll`]. fn stop_poll(&self, chat_id: C, message_id: i32) -> Self::StopPoll where C: Into; type DeleteMessage: Request; - /// For telegram documentation see [`DeleteMessage`] + /// For Telegram documentation see [`DeleteMessage`]. fn delete_message(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage where C: Into; type SendSticker: Request; - /// For telegram documentation see [`SendSticker`] + /// For Telegram documentation see [`SendSticker`]. fn send_sticker(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker where C: Into; type GetStickerSet: Request; - /// For telegram documentation see [`GetStickerSet`] + /// For Telegram documentation see [`GetStickerSet`]. fn get_sticker_set(&self, name: N) -> Self::GetStickerSet where N: Into; type UploadStickerFile: Request; - /// For telegram documentation see [`UploadStickerFile`] + /// For Telegram documentation see [`UploadStickerFile`]. fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile; type CreateNewStickerSet: Request; - /// For telegram documentation see [`CreateNewStickerSet`] + /// For Telegram documentation see [`CreateNewStickerSet`]. fn create_new_sticker_set( &self, user_id: i32, @@ -613,7 +614,7 @@ pub trait Requester { type AddStickerToSet: Request; - /// For telegram documentation see [`AddStickerToSet`] + /// For Telegram documentation see [`AddStickerToSet`]. fn add_sticker_to_set( &self, user_id: i32, @@ -627,7 +628,7 @@ pub trait Requester { type SetStickerPositionInSet: Request; - /// For telegram documentation see [`SetStickerPositionInSet`] + /// For Telegram documentation see [`SetStickerPositionInSet`]. fn set_sticker_position_in_set( &self, sticker: S, @@ -638,21 +639,21 @@ pub trait Requester { type DeleteStickerFromSet: Request; - /// For telegram documentation see [`DeleteStickerFromSet`] + /// For Telegram documentation see [`DeleteStickerFromSet`]. fn delete_sticker_from_set(&self, sticker: S) -> Self::DeleteStickerFromSet where S: Into; type SetStickerSetThumb: Request; - /// For telegram documentation see [`SetStickerSetThumb`] + /// For Telegram documentation see [`SetStickerSetThumb`]. fn set_sticker_set_thumb(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb where N: Into; type SendInvoice: Request; - /// For telegram documentation see [`SendInvoice`] + /// For Telegram documentation see [`SendInvoice`]. #[allow(clippy::too_many_arguments)] fn send_invoice( &self, @@ -676,14 +677,14 @@ pub trait Requester { type AnswerShippingQuery: Request; - /// For telegram documentation see [`AnswerShippingQuery`] + /// For Telegram documentation see [`AnswerShippingQuery`]. fn answer_shipping_query(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery where S: Into; type AnswerPreCheckoutQuery: Request; - /// For telegram documentation see [`AnswerPreCheckoutQuery`] + /// For Telegram documentation see [`AnswerPreCheckoutQuery`]. fn answer_pre_checkout_query

( &self, pre_checkout_query_id: P, @@ -694,7 +695,7 @@ pub trait Requester { type SetPassportDataErrors: Request; - /// For telegram documentation see [`SetPassportDataErrors`] + /// For Telegram documentation see [`SetPassportDataErrors`]. fn set_passport_data_errors(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors where E: IntoIterator; diff --git a/src/requests/requester_ext.rs b/src/requests/requester_ext.rs index 57ef9a52..5f4b9e20 100644 --- a/src/requests/requester_ext.rs +++ b/src/requests/requester_ext.rs @@ -9,6 +9,7 @@ use crate::adaptors::AutoSend; #[cfg(feature = "throttle")] use crate::adaptors::throttle::{Limits, Throttle}; +/// Extensions methods for [`Requester`]. pub trait RequesterExt: Requester { /// Add `get_me` caching ability, see [`CacheMe`] for more. ///