TextSearch

Struct TextSearch 

Source
pub struct TextSearch<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> TextSearch<'a>

Source

pub fn new(api_key: &str, client: &'a Client) -> Self

Source

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.

Source

pub fn with_radius(&mut self, radius: f64) -> &mut TextSearch<'a>

Assign the radius for a TextSearch call.

radius -> The search radius.

Source

pub fn with_language(&mut self, language: Language) -> &mut TextSearch<'a>

Assign the language for a TextSearch call.

language -> The language parameter.

Source

pub fn with_location(&mut self, location: Location) -> &mut TextSearch<'a>

Assign the location for a TextSearch call.

location -> The location parameter.

Source

pub fn with_maxprice(&mut self, maxprice: u8) -> &mut TextSearch<'a>

Assign the max price for a TextSearch call.

maxprice -> The maximum price level.

Source

pub fn with_minprice(&mut self, minprice: u8) -> &mut TextSearch<'a>

Assign the min price for a TextSearch call.

minprice -> The minimum price level.

Source

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.

Source

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.

Source

pub fn with_region(&mut self, region: &str) -> &mut TextSearch<'a>

Assign the region for a TextSearch call.

region -> The region parameter.

Source

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.

Source

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
Source

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:

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for TextSearch<'a>

§

impl<'a> !RefUnwindSafe for TextSearch<'a>

§

impl<'a> Send for TextSearch<'a>

§

impl<'a> Sync for TextSearch<'a>

§

impl<'a> Unpin for TextSearch<'a>

§

impl<'a> !UnwindSafe for TextSearch<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

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 T
where U: From<T>,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,