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(&con_token, &access_token) .unwrap(); for tweet in &search.response.statuses { println!("(@{}) {}", tweet.user.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.
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. |