mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Return named Polling<_>
type from polling* functions
This replaces the `impl UpdateListener<R::Err>` and makes using polling
nicer.
Former-commit-id: db417caa52
This commit is contained in:
parent
2ceccdf442
commit
e51c4c774c
1 changed files with 5 additions and 5 deletions
|
@ -71,7 +71,7 @@ where
|
|||
}
|
||||
|
||||
/// Creates a polling update listener.
|
||||
pub fn build(self) -> impl UpdateListener<R::Err> {
|
||||
pub fn build(self) -> Polling<R> {
|
||||
let Self { bot, timeout, limit, allowed_updates } = self;
|
||||
polling(bot, timeout, limit, allowed_updates)
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ where
|
|||
/// ## Notes
|
||||
///
|
||||
/// This function will automatically delete a webhook if it was set up.
|
||||
pub async fn polling_default<R>(bot: R) -> impl UpdateListener<R::Err>
|
||||
pub async fn polling_default<R>(bot: R) -> Polling<R>
|
||||
where
|
||||
R: Requester + Send + 'static,
|
||||
<R as Requester>::GetUpdates: Send,
|
||||
|
@ -198,7 +198,7 @@ pub fn polling<R>(
|
|||
timeout: Option<Duration>,
|
||||
limit: Option<u8>,
|
||||
allowed_updates: Option<Vec<AllowedUpdate>>,
|
||||
) -> impl UpdateListener<R::Err>
|
||||
) -> Polling<R>
|
||||
where
|
||||
R: Requester + Send + 'static,
|
||||
<R as Requester>::GetUpdates: Send,
|
||||
|
@ -228,7 +228,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
struct Polling<B: Requester> {
|
||||
pub struct Polling<B: Requester> {
|
||||
bot: B,
|
||||
timeout: Option<Duration>,
|
||||
limit: Option<u8>,
|
||||
|
@ -238,7 +238,7 @@ struct Polling<B: Requester> {
|
|||
}
|
||||
|
||||
#[pin_project::pin_project]
|
||||
struct PollingStream<'a, B: Requester> {
|
||||
pub struct PollingStream<'a, B: Requester> {
|
||||
/// Parent structure
|
||||
polling: &'a mut Polling<B>,
|
||||
|
||||
|
|
Loading…
Reference in a new issue