mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Make GetUpdates
expose its timeout
via Payload::timeout_hint
This commit is contained in:
parent
2dc4a915ba
commit
fb7710b838
2 changed files with 10 additions and 0 deletions
|
@ -99,6 +99,9 @@ macro_rules! impl_payload {
|
|||
$(
|
||||
@[multipart = $($multipart_attr:ident),*]
|
||||
)?
|
||||
$(
|
||||
@[timeout_secs = $timeout_secs:ident]
|
||||
)?
|
||||
$(
|
||||
#[ $($method_meta:tt)* ]
|
||||
)*
|
||||
|
@ -179,6 +182,12 @@ macro_rules! impl_payload {
|
|||
type Output = $Ret;
|
||||
|
||||
const NAME: &'static str = stringify!($Method);
|
||||
|
||||
$(
|
||||
fn timeout_hint(&self) -> Option<std::time::Duration> {
|
||||
self.$timeout_secs.map(<_>::into).map(std::time::Duration::from_secs)
|
||||
}
|
||||
)?
|
||||
}
|
||||
|
||||
calculated_doc! {
|
||||
|
|
|
@ -11,6 +11,7 @@ use serde::Serialize;
|
|||
use crate::types::{AllowedUpdate, Update};
|
||||
|
||||
impl_payload! {
|
||||
@[timeout_secs = timeout]
|
||||
/// Use this method to receive incoming updates using long polling ([wiki]). An Array of [`Update`] objects is returned.
|
||||
///
|
||||
/// [wiki]: https://en.wikipedia.org/wiki/Push_technology#Long_polling
|
||||
|
|
Loading…
Add table
Reference in a new issue