mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-10 20:12:25 +01:00
Merge pull request #568 from teloxide/stop_send
Require that `UpdateListener::StopToken` is `Send`
This commit is contained in:
commit
5bd134bc21
4 changed files with 9 additions and 7 deletions
|
@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## unreleased
|
## unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `UpdateListener::StopToken` is now always `Send`
|
||||||
|
|
||||||
## 0.7.2 - 2022-03-23
|
## 0.7.2 - 2022-03-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub use self::{
|
||||||
/// [module-level documentation]: mod@self
|
/// [module-level documentation]: mod@self
|
||||||
pub trait UpdateListener<E>: for<'a> AsUpdateStream<'a, E> {
|
pub trait UpdateListener<E>: for<'a> AsUpdateStream<'a, E> {
|
||||||
/// The type of token which allows to stop this listener.
|
/// The type of token which allows to stop this listener.
|
||||||
type StopToken: StopToken;
|
type StopToken: StopToken + Send;
|
||||||
|
|
||||||
/// Returns a token which stops this listener.
|
/// Returns a token which stops this listener.
|
||||||
///
|
///
|
||||||
|
|
|
@ -7,7 +7,7 @@ use futures::{
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
dispatching::{
|
dispatching::{
|
||||||
stop_token::{AsyncStopFlag, AsyncStopToken, StopToken},
|
stop_token::{AsyncStopFlag, AsyncStopToken},
|
||||||
update_listeners::{stateful_listener::StatefulListener, UpdateListener},
|
update_listeners::{stateful_listener::StatefulListener, UpdateListener},
|
||||||
},
|
},
|
||||||
payloads::{GetUpdates, GetUpdatesSetters as _},
|
payloads::{GetUpdates, GetUpdatesSetters as _},
|
||||||
|
@ -22,9 +22,7 @@ use crate::{
|
||||||
/// ## Notes
|
/// ## Notes
|
||||||
///
|
///
|
||||||
/// This function will automatically delete a webhook if it was set up.
|
/// This function will automatically delete a webhook if it was set up.
|
||||||
pub async fn polling_default<R>(
|
pub async fn polling_default<R>(requester: R) -> impl UpdateListener<R::Err>
|
||||||
requester: R,
|
|
||||||
) -> impl UpdateListener<R::Err, StopToken = impl Send + StopToken>
|
|
||||||
where
|
where
|
||||||
R: Requester + Send + 'static,
|
R: Requester + Send + 'static,
|
||||||
<R as Requester>::GetUpdates: Send,
|
<R as Requester>::GetUpdates: Send,
|
||||||
|
@ -130,7 +128,7 @@ pub fn polling<R>(
|
||||||
timeout: Option<Duration>,
|
timeout: Option<Duration>,
|
||||||
limit: Option<u8>,
|
limit: Option<u8>,
|
||||||
allowed_updates: Option<Vec<AllowedUpdate>>,
|
allowed_updates: Option<Vec<AllowedUpdate>>,
|
||||||
) -> impl UpdateListener<R::Err, StopToken = impl Send + StopToken>
|
) -> impl UpdateListener<R::Err>
|
||||||
where
|
where
|
||||||
R: Requester + Send + 'static,
|
R: Requester + Send + 'static,
|
||||||
<R as Requester>::GetUpdates: Send,
|
<R as Requester>::GetUpdates: Send,
|
||||||
|
|
|
@ -123,7 +123,7 @@ impl<St, Assf, Sf, Hauf, Stt, Thf, E> UpdateListener<E>
|
||||||
where
|
where
|
||||||
Self: for<'a> AsUpdateStream<'a, E>,
|
Self: for<'a> AsUpdateStream<'a, E>,
|
||||||
Sf: FnMut(&mut St) -> Stt,
|
Sf: FnMut(&mut St) -> Stt,
|
||||||
Stt: StopToken,
|
Stt: StopToken + Send,
|
||||||
Hauf: FnMut(&mut St, &mut dyn Iterator<Item = AllowedUpdate>),
|
Hauf: FnMut(&mut St, &mut dyn Iterator<Item = AllowedUpdate>),
|
||||||
Thf: Fn(&St) -> Option<Duration>,
|
Thf: Fn(&St) -> Option<Duration>,
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue