Module egg_mode::search [] [src]

Structs and methods for searching for tweets.

Since there are several optional parameters for searches, egg-mode handles it with a builder pattern. To begin, call search with your requested search term. Additional parameters can be added onto the SearchBuilder struct that is returned. When you're ready to load the first page of results, hand your tokens to call.

use egg_mode::search::{self, ResultType};

let search = search::search("rustlang")
                    .result_type(ResultType::Recent)
                    .call(&token)
                    .unwrap();

for tweet in &search.statuses {
    println!("(@{}) {}", tweet.user.as_ref().unwrap().screen_name, tweet.text);
}

Once you have your SearchResult, you can navigate the search results by calling older and newer to get the next and previous pages, respsectively. In addition, you can see your original query in the search result struct as well, so you can categorize multiple searches by their query. While this is given as a regular field, note that modifying query will not change what is searched for when you call older or newer; the SearchResult keeps its search arguments in a separate private field.

The search parameter given in the initial call to search has several options itself. A full reference is available in Twitter's Search API documentation. This listing by itself does not include the search by Place ID, as mentioned on a separate Tweets by Place page. A future version of egg-mode might break these options into further methods on SearchBuilder.

Structs

SearchBuilder

Represents a tweet search query before being sent.

SearchResult

Represents a page of search results, along with metadata to request the next or previous page.

Enums

Distance

Represents a radius around a given location to return search results for.

ResultType

Represents what kind of tweets should be included in search results.

Functions

search

Begin setting up a tweet search with the given query.