diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b0dd6fc..d2c68377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## unreleased +### Changed + +- `UpdateListener::StopToken` is now always `Send` + ## 0.7.2 - 2022-03-23 ### Added diff --git a/src/dispatching/update_listeners.rs b/src/dispatching/update_listeners.rs index 18d294d1..b2afa015 100644 --- a/src/dispatching/update_listeners.rs +++ b/src/dispatching/update_listeners.rs @@ -53,7 +53,7 @@ pub use self::{ /// [module-level documentation]: mod@self pub trait UpdateListener: for<'a> AsUpdateStream<'a, E> { /// The type of token which allows to stop this listener. - type StopToken: StopToken; + type StopToken: StopToken + Send; /// Returns a token which stops this listener. /// diff --git a/src/dispatching/update_listeners/polling.rs b/src/dispatching/update_listeners/polling.rs index acc21e12..3987779d 100644 --- a/src/dispatching/update_listeners/polling.rs +++ b/src/dispatching/update_listeners/polling.rs @@ -7,7 +7,7 @@ use futures::{ use crate::{ dispatching::{ - stop_token::{AsyncStopFlag, AsyncStopToken, StopToken}, + stop_token::{AsyncStopFlag, AsyncStopToken}, update_listeners::{stateful_listener::StatefulListener, UpdateListener}, }, payloads::{GetUpdates, GetUpdatesSetters as _}, @@ -22,9 +22,7 @@ use crate::{ /// ## Notes /// /// This function will automatically delete a webhook if it was set up. -pub async fn polling_default( - requester: R, -) -> impl UpdateListener +pub async fn polling_default(requester: R) -> impl UpdateListener where R: Requester + Send + 'static, ::GetUpdates: Send, @@ -130,7 +128,7 @@ pub fn polling( timeout: Option, limit: Option, allowed_updates: Option>, -) -> impl UpdateListener +) -> impl UpdateListener where R: Requester + Send + 'static, ::GetUpdates: Send, diff --git a/src/dispatching/update_listeners/stateful_listener.rs b/src/dispatching/update_listeners/stateful_listener.rs index df32361c..e37a9efc 100644 --- a/src/dispatching/update_listeners/stateful_listener.rs +++ b/src/dispatching/update_listeners/stateful_listener.rs @@ -123,7 +123,7 @@ impl UpdateListener where Self: for<'a> AsUpdateStream<'a, E>, Sf: FnMut(&mut St) -> Stt, - Stt: StopToken, + Stt: StopToken + Send, Hauf: FnMut(&mut St, &mut dyn Iterator), Thf: Fn(&St) -> Option, {