pub struct TextSearch<'a> { /* private fields */ }Implementations§
Source§impl<'a> TextSearch<'a>
impl<'a> TextSearch<'a>
pub fn new(api_key: &str, client: &'a Client) -> Self
Sourcepub fn with_query(&mut self, text_query: &str) -> &mut TextSearch<'a>
pub fn with_query(&mut self, text_query: &str) -> &mut TextSearch<'a>
Assign the query string for a TextSearch call.
text_query -> The query text.
Sourcepub fn with_radius(&mut self, radius: f64) -> &mut TextSearch<'a>
pub fn with_radius(&mut self, radius: f64) -> &mut TextSearch<'a>
Assign the radius for a TextSearch call.
radius -> The search radius.
Sourcepub fn with_language(&mut self, language: Language) -> &mut TextSearch<'a>
pub fn with_language(&mut self, language: Language) -> &mut TextSearch<'a>
Assign the language for a TextSearch call.
language -> The language parameter.
Sourcepub fn with_location(&mut self, location: Location) -> &mut TextSearch<'a>
pub fn with_location(&mut self, location: Location) -> &mut TextSearch<'a>
Assign the location for a TextSearch call.
location -> The location parameter.
Sourcepub fn with_maxprice(&mut self, maxprice: u8) -> &mut TextSearch<'a>
pub fn with_maxprice(&mut self, maxprice: u8) -> &mut TextSearch<'a>
Assign the max price for a TextSearch call.
maxprice -> The maximum price level.
Sourcepub fn with_minprice(&mut self, minprice: u8) -> &mut TextSearch<'a>
pub fn with_minprice(&mut self, minprice: u8) -> &mut TextSearch<'a>
Assign the min price for a TextSearch call.
minprice -> The minimum price level.
Sourcepub fn with_opennow(&mut self, opennow: bool) -> &mut TextSearch<'a>
pub fn with_opennow(&mut self, opennow: bool) -> &mut TextSearch<'a>
Assign the open now filter for a TextSearch call.
opennow -> Whether the search should only include places that are open now.
Sourcepub fn with_pagetoken(&mut self, pagetoken: &str) -> &mut TextSearch<'a>
pub fn with_pagetoken(&mut self, pagetoken: &str) -> &mut TextSearch<'a>
Assign the page token for a TextSearch call.
pagetoken -> The page token for the results.
Sourcepub fn with_region(&mut self, region: &str) -> &mut TextSearch<'a>
pub fn with_region(&mut self, region: &str) -> &mut TextSearch<'a>
Assign the region for a TextSearch call.
region -> The region parameter.
Sourcepub fn with_type(&mut self, place_type: PlaceTypes) -> &mut TextSearch<'a>
pub fn with_type(&mut self, place_type: PlaceTypes) -> &mut TextSearch<'a>
Assign the place type for a TextSearch call.
place_type -> The type of place.
Sourcepub async fn execute(&mut self, max_pages: usize) -> Option<&mut TextSearch<'a>>
pub async fn execute(&mut self, max_pages: usize) -> Option<&mut TextSearch<'a>>
Execute the TextSearch call in a non-blocking fashion.
This will make a request to the Google Places API and retrieve the results. The results will be stored in the result field of the TextSearch struct.
If the query is successful, the method will return Some(self). If the query fails, the method will return None.
§Panics
Panics if the query_text and type fields are both None.
§Errors
If the query fails, the method will return None. In this case, you should check the error message contained in the result field of the TextSearch struct.
§Examples
Sourcepub fn iter(&mut self) -> TextSearchIter<'_, 'a> ⓘ
pub fn iter(&mut self) -> TextSearchIter<'_, 'a> ⓘ
This function returns an iterator (TextSearchIter) over the places in a TextSearch object. The iterator is initialized to start at the first place (index 0).
It allows you to iterate over the places in the TextSearch result without having to manually keep track of the index.
For example, you can use it like this:
Sourcepub fn at(&self, index: usize) -> Option<&PlaceSearchPlace>
pub fn at(&self, index: usize) -> Option<&PlaceSearchPlace>
Retrieve the place at the specified index.
index -> The index of the place to retrieve.
Returns an Option with the place if it exists, or None if the index is out of range.
Sourcepub fn get_result(&'a self) -> TextSearchResult
pub fn get_result(&'a self) -> TextSearchResult
Retrieve a cloned TextSearchResult.
This function returns a clone of the TextSearchResult associated with the TextSearch instance.
§Returns
A TextSearchResult object that contains the results of the text search operation.