[][src]Struct telegram_bot::UpdatesStream

#[must_use = "streams do nothing unless polled"]pub struct UpdatesStream { /* fields omitted */ }

This type represents stream of Telegram API updates and uses long polling method under the hood.


impl UpdatesStream[src]

pub fn new(api: &Api) -> Self[src]

create a new UpdatesStream instance.

pub fn timeout(&mut self, timeout: Duration) -> &mut Self[src]

Set timeout for long polling requests, this corresponds with timeout field in getUpdates method, also this stream sets an additional request timeout for timeout + 1 second in case of invalid Telegram API server behaviour.

Default timeout is 5 seconds.

pub fn allowed_updates(
    &mut self,
    allowed_updates: &[AllowedUpdate]
) -> &mut Self

Set allowed updates to receive, this corresponds with allowed_updates field in getUpdates method. List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all updates regardless of type (default). If not specified, the previous setting will be used.

Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.

pub fn limit(&mut self, limit: Integer) -> &mut Self[src]

Set limits the number of updates to be retrieved, this corresponds with limit field in getUpdates method. Values between 1—100 are accepted.

Defaults to 100.

pub fn error_delay(&mut self, delay: Duration) -> &mut Self[src]

Set a delay between erroneous request and next request. This delay prevents busy looping in some cases.

Default delay is 500 ms.

Trait Implementations

impl Stream for UpdatesStream[src]

type Item = Result<Update, Error>

Values yielded by the stream.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]