mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +01:00
commit
15a6825f53
8 changed files with 54 additions and 17 deletions
|
@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [unreleased]
|
## [unreleased]
|
||||||
|
|
||||||
|
## 0.3.1 - 2021-07-07
|
||||||
|
|
||||||
|
- Minor documentation tweaks ([#102][pr102])
|
||||||
|
- Remove `Self: 'static` buound on `RequesterExt::throttle` ([#102][pr102])
|
||||||
|
|
||||||
|
[pr102]: https://github.com/teloxide/teloxide-core/pull/102
|
||||||
|
|
||||||
## 0.3.0 - 2021-07-05
|
## 0.3.0 - 2021-07-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "teloxide-core"
|
name = "teloxide-core"
|
||||||
description = "Core part of the `teloxide` library - telegram bot API client"
|
description = "Core part of the `teloxide` library - telegram bot API client"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = [
|
authors = [
|
||||||
"Temirkhan Myrzamadi <hirrolot@gmail.com>",
|
"Temirkhan Myrzamadi <hirrolot@gmail.com>",
|
||||||
|
|
|
@ -14,7 +14,10 @@
|
||||||
/// [`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")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "auto_send")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "auto_send"))
|
||||||
|
)]
|
||||||
pub mod auto_send;
|
pub mod auto_send;
|
||||||
|
|
||||||
/// [`CacheMe`] bot adaptor which caches [`GetMe`] requests.
|
/// [`CacheMe`] bot adaptor which caches [`GetMe`] requests.
|
||||||
|
@ -22,7 +25,10 @@ pub mod auto_send;
|
||||||
/// [`CacheMe`]: cache_me::CacheMe
|
/// [`CacheMe`]: cache_me::CacheMe
|
||||||
/// [`GetMe`]: crate::payloads::GetMe
|
/// [`GetMe`]: crate::payloads::GetMe
|
||||||
#[cfg(feature = "cache_me")]
|
#[cfg(feature = "cache_me")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "cache_me")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "cache_me"))
|
||||||
|
)]
|
||||||
pub mod cache_me;
|
pub mod cache_me;
|
||||||
|
|
||||||
/// [`Throttle`] bot adaptor which allows automatically throttle when hitting
|
/// [`Throttle`] bot adaptor which allows automatically throttle when hitting
|
||||||
|
@ -30,19 +36,31 @@ pub mod cache_me;
|
||||||
///
|
///
|
||||||
/// [`Throttle`]: throttle::Throttle
|
/// [`Throttle`]: throttle::Throttle
|
||||||
#[cfg(feature = "throttle")]
|
#[cfg(feature = "throttle")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "throttle")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "throttle"))
|
||||||
|
)]
|
||||||
pub mod throttle;
|
pub mod throttle;
|
||||||
|
|
||||||
mod parse_mode;
|
mod parse_mode;
|
||||||
|
|
||||||
#[cfg(feature = "auto_send")]
|
#[cfg(feature = "auto_send")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "auto_send")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "auto_send"))
|
||||||
|
)]
|
||||||
pub use auto_send::AutoSend;
|
pub use auto_send::AutoSend;
|
||||||
#[cfg(feature = "cache_me")]
|
#[cfg(feature = "cache_me")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "cache_me")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "cache_me"))
|
||||||
|
)]
|
||||||
pub use cache_me::CacheMe;
|
pub use cache_me::CacheMe;
|
||||||
#[cfg(feature = "throttle")]
|
#[cfg(feature = "throttle")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "throttle")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "throttle"))
|
||||||
|
)]
|
||||||
pub use throttle::Throttle;
|
pub use throttle::Throttle;
|
||||||
|
|
||||||
pub use parse_mode::DefaultParseMode;
|
pub use parse_mode::DefaultParseMode;
|
||||||
|
|
|
@ -72,7 +72,13 @@
|
||||||
// ```console
|
// ```console
|
||||||
// $ RUSTDOCFLAGS="--cfg docsrs -Znormalize-docs" cargo doc --open --all-features
|
// $ RUSTDOCFLAGS="--cfg docsrs -Znormalize-docs" cargo doc --open --all-features
|
||||||
// ```
|
// ```
|
||||||
#![cfg_attr(all(docsrs, feature = "nightly"), feature(doc_cfg, doc_notable_trait))]
|
//
|
||||||
|
// `dep_docsrs` is used for the same purpose, but when `teloxide-core` is built as a dependency
|
||||||
|
// (see: `teloxide`). We can't use `docsrs` as it breaks tokio compilation in this case.
|
||||||
|
#![cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
feature(doc_cfg, doc_notable_trait)
|
||||||
|
)]
|
||||||
#![cfg_attr(feature = "nightly", feature(min_type_alias_impl_trait))]
|
#![cfg_attr(feature = "nightly", feature(min_type_alias_impl_trait))]
|
||||||
#![cfg_attr(all(feature = "full", docsrs), deny(rustdoc::broken_intra_doc_links))]
|
#![cfg_attr(all(feature = "full", docsrs), deny(rustdoc::broken_intra_doc_links))]
|
||||||
//#![deny(missing_docs)]
|
//#![deny(missing_docs)]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
///
|
///
|
||||||
/// Also, this trait provides some additional information needed to send a
|
/// Also, this trait provides some additional information needed to send a
|
||||||
/// request to Telegram.
|
/// request to Telegram.
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(notable_trait))]
|
#[cfg_attr(all(any(docsrs, dep_docsrs), feature = "nightly"), doc(notable_trait))]
|
||||||
pub trait Payload {
|
pub trait Payload {
|
||||||
/// The return type of a Telegram method.
|
/// The return type of a Telegram method.
|
||||||
///
|
///
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::requests::{HasPayload, Output};
|
||||||
/// `B::send_ref` while _not_ meaning to really send the request at the moment.
|
/// `B::send_ref` while _not_ meaning to really send the request at the moment.
|
||||||
///
|
///
|
||||||
/// [`Throttle<B>`]: crate::adaptors::Throttle
|
/// [`Throttle<B>`]: crate::adaptors::Throttle
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(notable_trait))]
|
#[cfg_attr(all(any(docsrs, dep_docsrs), feature = "nightly"), doc(notable_trait))]
|
||||||
pub trait Request: HasPayload {
|
pub trait Request: HasPayload {
|
||||||
/*
|
/*
|
||||||
* Could be mostly `core::future::IntoFuture` though there is no reason to
|
* Could be mostly `core::future::IntoFuture` though there is no reason to
|
||||||
|
|
|
@ -49,7 +49,7 @@ use crate::{
|
||||||
/// bot.send_message(chat, "hi").send().await.expect("error")
|
/// bot.send_message(chat, "hi").send().await.expect("error")
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(notable_trait))]
|
#[cfg_attr(all(any(docsrs, dep_docsrs), feature = "nightly"), doc(notable_trait))]
|
||||||
pub trait Requester {
|
pub trait Requester {
|
||||||
/// Error type returned by all requests.
|
/// Error type returned by all requests.
|
||||||
type Err: std::error::Error + Send;
|
type Err: std::error::Error + Send;
|
||||||
|
|
|
@ -15,7 +15,10 @@ pub trait RequesterExt: Requester {
|
||||||
///
|
///
|
||||||
/// [`CacheMe`]:
|
/// [`CacheMe`]:
|
||||||
#[cfg(feature = "cache_me")]
|
#[cfg(feature = "cache_me")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "cache_me")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "cache_me"))
|
||||||
|
)]
|
||||||
fn cache_me(self) -> CacheMe<Self>
|
fn cache_me(self) -> CacheMe<Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
|
@ -25,7 +28,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")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "auto_send")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "auto_send"))
|
||||||
|
)]
|
||||||
fn auto_send(self) -> AutoSend<Self>
|
fn auto_send(self) -> AutoSend<Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
|
@ -37,13 +43,13 @@ pub trait RequesterExt: Requester {
|
||||||
///
|
///
|
||||||
/// Note: this spawns the worker, just as [`Throttle::new_spawn`].
|
/// Note: this spawns the worker, just as [`Throttle::new_spawn`].
|
||||||
#[cfg(feature = "throttle")]
|
#[cfg(feature = "throttle")]
|
||||||
#[cfg_attr(all(docsrs, feature = "nightly"), doc(cfg(feature = "throttle")))]
|
#[cfg_attr(
|
||||||
|
all(any(docsrs, dep_docsrs), feature = "nightly"),
|
||||||
|
doc(cfg(feature = "throttle"))
|
||||||
|
)]
|
||||||
fn throttle(self, limits: Limits) -> Throttle<Self>
|
fn throttle(self, limits: Limits) -> Throttle<Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
// >:(
|
|
||||||
// (waffle)
|
|
||||||
Self: 'static,
|
|
||||||
{
|
{
|
||||||
Throttle::new_spawn(self, limits)
|
Throttle::new_spawn(self, limits)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue