pub struct StreamBuilder { /* private fields */ }
Expand description

Represents a TwitterStream before it is started. Use the various methods to build up the filters on your stream.

Bear in mind that the track, follow and locations filters are ORed rather than ANDed together. E.g. if you specify a user id to follow and a phrase to track, you will receive all tweets that match (user id OR phrase), NOT (user id AND phrase). For more details see the official docs

Note: The user must specify at least one track, follow or locations filter or else the stream will fail at point of connection.

Implementations§

source§

impl StreamBuilder

source

pub fn follow(self, to_follow: &[u64]) -> Self

Filter stream to only return Tweets relating to given user IDs.

Example
use egg_mode::stream::filter;
let stream = filter()
    // View tweets related to BBC news, the Guardian and the New York Times
    .follow(&[612473, 87818409, 807095])
    .start(&token);
source

pub fn track<I: IntoIterator<Item = S>, S: AsRef<str>>(self, to_track: I) -> Self

Filter stream to only return Tweets containing given phrases.

A phrase may be one or more terms separated by spaces, and a phrase will match if all of the terms in the phrase are present in the Tweet, regardless of order and ignoring case.

source

pub fn language<I: IntoIterator<Item = S>, S: AsRef<str>>(
    self,
    languages: I
) -> Self

Filter stream to only return Tweets that have been detected as being written in the specified languages.

Languages are specified as a list of BCP 47 language identifiers corresponding to any of the languages listed on Twitter’s advanced search page.

Note This library does not validate the language codes.

source

pub fn locations(self, locations: &[BoundingBox]) -> Self

A list of bounding boxes by which to filter Tweets

Example
use egg_mode::stream::{filter, BoundingBox};
let stream = filter()
    // Only show tweets sent from New York
    .locations(&[BoundingBox::new((-74.0,40.0),(-73.0,41.0))])
    .start(&token);
source

pub fn filter_level(self, filter_level: FilterLevel) -> StreamBuilder

Applies the given FilterLevel to the stream. Tweets with a filter_level below the given value will not be shown in the stream.

When displaying a stream of Tweets to end users (dashboards or live feeds at a presentation or conference, for example) it is suggested that you set this value to medium.

source

pub fn start(self, token: &Token) -> TwitterStream

Finalizes the stream parameters and returns the resulting TwitterStream.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
    S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more