[][src]Struct twitter_stream::builder::Builder

pub struct Builder<'a, T = Token> { /* fields omitted */ }

A builder for TwitterStream.

See the builder module documentation for details.

Implementations

impl<'a, C, A> Builder<'a, Token<C, A>> where
    C: AsRef<str>,
    A: AsRef<str>, 
[src]

pub fn new(token: Token<C, A>) -> Self[src]

Creates a builder.

pub fn listen(&self) -> FutureTwitterStream[src]

This is supported on crate feature hyper only.

Start listening on the Streaming API endpoint, returning a Future which resolves to a Stream yielding JSON messages from the API.

Panics

This will panic if the underlying HTTPS connector failed to initialize.

pub fn listen_with_client<S, B>(
    &self,
    mut client: S
) -> FutureTwitterStream<S::Future>

Notable traits for FutureTwitterStream<F>

impl<F, B, E> Future for FutureTwitterStream<F> where
    F: Future<Output = Result<Response<B>, E>>,
    B: Body
type Output = Result<TwitterStream<B>, Error<E>>;
where
    S: HttpService<B>,
    B: From<Vec<u8>>, 
[src]

Same as listen except that it uses client to make HTTP request to the endpoint.

client must be able to handle the https scheme.

Panics

This will call <S as Service>::call without checking for <S as Service>::poll_ready and may cause a panic if client is not ready to send an HTTP request yet.

Example

use tower::ServiceExt;

let stream = twitter_stream::Builder::new(token)
    .listen_with_client(client.ready_and().await?)
    .await
    .unwrap();

impl<'a, C, A> Builder<'a, Token<C, A>>[src]

pub fn endpoint(
    &mut self,
    endpoint: impl Into<Option<(RequestMethod, Uri)>>
) -> &mut Self
[src]

Set the API endpoint URI to be connected.

This overrides the default behavior of automatically determining the endpoint to use.

pub fn token(&mut self, token: Token<C, A>) -> &mut Self[src]

Reset the token to be used to log into Twitter.

pub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self[src]

Set whether to receive messages when in danger of being disconnected.

See the Twitter Developer Documentation for more information.

pub fn filter_level(
    &mut self,
    filter_level: impl Into<Option<FilterLevel>>
) -> &mut Self
[src]

Set the minimum filter_level Tweet attribute to receive. The default is FilterLevel::None.

See the Twitter Developer Documentation for more information.

pub fn language(&mut self, language: impl Into<Cow<'a, str>>) -> &mut Self[src]

Set a comma-separated language identifiers to receive Tweets written in the specified languages only.

Setting an empty string will unset this parameter.

See the Twitter Developer Documentation for more information.

pub fn follow(&mut self, follow: impl Into<Cow<'a, [u64]>>) -> &mut Self[src]

Set a list of user IDs to receive Tweets from the specified users.

Setting an empty slice will unset this parameter.

See the Twitter Developer Documentation for more information.

pub fn track(&mut self, track: impl Into<Cow<'a, str>>) -> &mut Self[src]

A comma separated list of phrases to filter Tweets by.

Setting an empty string will unset this parameter.

See the Twitter Developer Documentation for more information.

pub fn locations(
    &mut self,
    locations: impl Into<Cow<'a, [BoundingBox]>>
) -> &mut Self
[src]

Set a list of bounding boxes to filter Tweets by.

Setting an empty slice will unset this parameter.

See BoundingBox and the Twitter Developer Documentation for more information.

pub fn count(&mut self, count: impl Into<Option<i32>>) -> &mut Self[src]

The count parameter. This parameter requires elevated access to use.

See the Twitter Developer Documentation for more information.

Trait Implementations

impl<'a, T: Clone> Clone for Builder<'a, T>[src]

impl<'a, T: Debug> Debug for Builder<'a, T>[src]

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Builder<'a, T> where
    T: RefUnwindSafe
[src]

impl<'a, T> Send for Builder<'a, T> where
    T: Send
[src]

impl<'a, T> Sync for Builder<'a, T> where
    T: Sync
[src]

impl<'a, T> Unpin for Builder<'a, T> where
    T: Unpin
[src]

impl<'a, T> UnwindSafe for Builder<'a, T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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