[−][src]Struct twitter_stream::TwitterStreamBuilder
A builder for TwitterStream
.
Example
extern crate twitter_stream; use twitter_stream::{Token, TwitterStreamBuilder}; use twitter_stream::rt::{self, Future, Stream}; let token = Token::new("consumer_key", "consumer_secret", "access_key", "access_secret"); let future = TwitterStreamBuilder::sample(token) .timeout(None) .listen() .unwrap() .flatten_stream() .for_each(|json| { println!("{}", json); Ok(()) }) .map_err(|e| println!("error: {}", e)); rt::run(future);
Methods
impl<'a, C, A> TwitterStreamBuilder<'a, Token<C, A>> where
C: Borrow<str>,
A: Borrow<str>,
[src]
impl<'a, C, A> TwitterStreamBuilder<'a, Token<C, A>> where
C: Borrow<str>,
A: Borrow<str>,
pub fn filter(token: Token<C, A>) -> Self
[src]
pub fn filter(token: Token<C, A>) -> Self
Create a builder for POST statuses/filter
endpoint.
See the Twitter Developer Documentation for more information.
pub fn sample(token: Token<C, A>) -> Self
[src]
pub fn sample(token: Token<C, A>) -> Self
Create a builder for GET statuses/sample
endpoint.
See the Twitter Developer Documentation for more information.
pub fn custom(method: RequestMethod, endpoint: Uri, token: Token<C, A>) -> Self
[src]
pub fn custom(method: RequestMethod, endpoint: Uri, token: Token<C, A>) -> Self
Constructs a builder for a Stream at a custom endpoint.
pub fn listen(&self) -> Result<FutureTwitterStream, TlsError>
[src]
pub fn listen(&self) -> Result<FutureTwitterStream, TlsError>
Start listening on the Streaming API endpoint, returning a Future
which resolves
to a Stream
yielding JSON messages from the API.
pub fn listen_with_client<Conn, B>(
&self,
client: &Client<Conn, B>
) -> FutureTwitterStream where
Conn: Connect + Sync + 'static,
Conn::Transport: 'static,
Conn::Future: 'static,
B: Default + From<Vec<u8>> + Payload + Send + 'static,
B::Data: Send,
[src]
pub fn listen_with_client<Conn, B>(
&self,
client: &Client<Conn, B>
) -> FutureTwitterStream where
Conn: Connect + Sync + 'static,
Conn::Transport: 'static,
Conn::Future: 'static,
B: Default + From<Vec<u8>> + Payload + Send + 'static,
B::Data: Send,
Same as listen
except that it uses client
to make HTTP request to the endpoint.
impl<'a, C, A> TwitterStreamBuilder<'a, Token<C, A>>
[src]
impl<'a, C, A> TwitterStreamBuilder<'a, Token<C, A>>
pub fn method(&mut self, method: RequestMethod) -> &mut Self
[src]
pub fn method(&mut self, method: RequestMethod) -> &mut Self
Reset the HTTP request method to be used when connecting to the server.
pub fn endpoint(&mut self, endpoint: Uri) -> &mut Self
[src]
pub fn endpoint(&mut self, endpoint: Uri) -> &mut Self
Reset the API endpoint URI to be connected.
pub fn token(&mut self, token: Token<C, A>) -> &mut Self
[src]
pub fn token(&mut self, token: Token<C, A>) -> &mut Self
Reset the token to be used to log into Twitter.
pub fn timeout(
&mut self,
timeout: impl Into<Option<Duration>>
) -> &mut Self
[src]
pub fn timeout(
&mut self,
timeout: impl Into<Option<Duration>>
) -> &mut Self
Set a timeout for the stream. None
means infinity.
pub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self
[src]
pub fn stall_warnings(&mut self, stall_warnings: bool) -> &mut Self
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]
pub fn filter_level(
&mut self,
filter_level: impl Into<Option<FilterLevel>>
) -> &mut Self
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<Option<&'a str>>
) -> &mut Self
[src]
pub fn language(
&mut self,
language: impl Into<Option<&'a str>>
) -> &mut Self
Set a comma-separated language identifiers to receive Tweets written in the specified languages only.
See the Twitter Developer Documentation for more information.
pub fn follow(
&mut self,
follow: impl Into<Option<&'a [u64]>>
) -> &mut Self
[src]
pub fn follow(
&mut self,
follow: impl Into<Option<&'a [u64]>>
) -> &mut Self
Set a list of user IDs to receive Tweets only from the specified users.
See the Twitter Developer Documentation for more information.
pub fn track(
&mut self,
track: impl Into<Option<&'a str>>
) -> &mut Self
[src]
pub fn track(
&mut self,
track: impl Into<Option<&'a str>>
) -> &mut Self
A comma separated list of phrases to filter Tweets by.
See the Twitter Developer Documentation for more information.
pub fn locations(
&mut self,
locations: impl Into<Option<&'a [((f64, f64), (f64, f64))]>>
) -> &mut Self
[src]
pub fn locations(
&mut self,
locations: impl Into<Option<&'a [((f64, f64), (f64, f64))]>>
) -> &mut Self
Set a list of bounding boxes to filter Tweets by,
specified by a pair of coordinates in the form of
((longitude, latitude), (longitude, latitude))
tuple.
See the Twitter Developer Documentation for more information.
pub fn count(
&mut self,
count: impl Into<Option<i32>>
) -> &mut Self
[src]
pub fn count(
&mut self,
count: impl Into<Option<i32>>
) -> &mut Self
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 TwitterStreamBuilder<'a, T>
[src]
impl<'a, T: Clone> Clone for TwitterStreamBuilder<'a, T>
fn clone(&self) -> TwitterStreamBuilder<'a, T>
[src]
fn clone(&self) -> TwitterStreamBuilder<'a, T>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<'a, T: Debug> Debug for TwitterStreamBuilder<'a, T>
[src]
impl<'a, T: Debug> Debug for TwitterStreamBuilder<'a, T>
Auto Trait Implementations
impl<'a, T> Send for TwitterStreamBuilder<'a, T> where
T: Send,
impl<'a, T> Send for TwitterStreamBuilder<'a, T> where
T: Send,
impl<'a, T> Sync for TwitterStreamBuilder<'a, T> where
T: Sync,
impl<'a, T> Sync for TwitterStreamBuilder<'a, T> where
T: Sync,
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self