mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Require that UpdateListener::StopToken
is Send
This commit is contained in:
parent
10b1e045c7
commit
ceb2415351
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
|
||||
|
||||
### Changed
|
||||
|
||||
- `UpdateListener::StopToken` is now always `Send`
|
||||
|
||||
## 0.7.2 - 2022-03-23
|
||||
|
||||
### Added
|
||||
|
|
|
@ -53,7 +53,7 @@ pub use self::{
|
|||
/// [module-level documentation]: mod@self
|
||||
pub trait UpdateListener<E>: 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.
|
||||
///
|
||||
|
|
|
@ -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<R>(
|
||||
requester: R,
|
||||
) -> impl UpdateListener<R::Err, StopToken = impl Send + StopToken>
|
||||
pub async fn polling_default<R>(requester: R) -> impl UpdateListener<R::Err>
|
||||
where
|
||||
R: Requester + Send + 'static,
|
||||
<R as Requester>::GetUpdates: Send,
|
||||
|
@ -130,7 +128,7 @@ pub fn polling<R>(
|
|||
timeout: Option<Duration>,
|
||||
limit: Option<u8>,
|
||||
allowed_updates: Option<Vec<AllowedUpdate>>,
|
||||
) -> impl UpdateListener<R::Err, StopToken = impl Send + StopToken>
|
||||
) -> impl UpdateListener<R::Err>
|
||||
where
|
||||
R: Requester + Send + 'static,
|
||||
<R as Requester>::GetUpdates: Send,
|
||||
|
|
|
@ -123,7 +123,7 @@ impl<St, Assf, Sf, Hauf, Stt, Thf, E> UpdateListener<E>
|
|||
where
|
||||
Self: for<'a> AsUpdateStream<'a, E>,
|
||||
Sf: FnMut(&mut St) -> Stt,
|
||||
Stt: StopToken,
|
||||
Stt: StopToken + Send,
|
||||
Hauf: FnMut(&mut St, &mut dyn Iterator<Item = AllowedUpdate>),
|
||||
Thf: Fn(&St) -> Option<Duration>,
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue