pub struct SearchQuery {
pub q: String,
pub location: Option<String>,
pub gl: Option<String>,
pub hl: Option<String>,
pub page: Option<u32>,
pub num: Option<u32>,
}
Expand description
Represents a search query with all possible parameters
This struct encapsulates all the parameters that can be sent to the Serper API for search requests, with optional fields for flexible query construction.
Fields§
§q: String
The search query string (required)
location: Option<String>
Optional location specification
gl: Option<String>
Optional country code (gl parameter)
hl: Option<String>
Optional language code (hl parameter)
page: Option<u32>
Optional page number for pagination
num: Option<u32>
Optional number of results per page
Implementations§
Source§impl SearchQuery
impl SearchQuery
Sourcepub fn with_location(self, location: String) -> Self
pub fn with_location(self, location: String) -> Self
Sets the location for the search query
§Arguments
location
- The location string (e.g., “Paris, France”)
Sourcepub fn with_country(self, country: String) -> Self
pub fn with_country(self, country: String) -> Self
Sourcepub fn with_language(self, language: String) -> Self
pub fn with_language(self, language: String) -> Self
Sets the language code for the search query
§Arguments
language
- The language code (e.g., “en”, “fr”)
Sourcepub fn with_num_results(self, num: u32) -> Self
pub fn with_num_results(self, num: u32) -> Self
Sourcepub fn with_location_config(self, location: Location) -> Self
pub fn with_location_config(self, location: Location) -> Self
Sourcepub fn with_pagination(self, pagination: Pagination) -> Self
pub fn with_pagination(self, pagination: Pagination) -> Self
Applies pagination settings from a Pagination struct
§Arguments
pagination
- The pagination configuration
Sourcepub fn has_location_params(&self) -> bool
pub fn has_location_params(&self) -> bool
Checks if the query has location parameters
Sourcepub fn has_pagination_params(&self) -> bool
pub fn has_pagination_params(&self) -> bool
Checks if the query has pagination parameters
Trait Implementations§
Source§impl Clone for SearchQuery
impl Clone for SearchQuery
Source§fn clone(&self) -> SearchQuery
fn clone(&self) -> SearchQuery
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SearchQuery
impl Debug for SearchQuery
Source§impl<'de> Deserialize<'de> for SearchQuery
impl<'de> Deserialize<'de> for SearchQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SearchQuery
impl PartialEq for SearchQuery
Source§impl Serialize for SearchQuery
impl Serialize for SearchQuery
impl StructuralPartialEq for SearchQuery
Auto Trait Implementations§
impl Freeze for SearchQuery
impl RefUnwindSafe for SearchQuery
impl Send for SearchQuery
impl Sync for SearchQuery
impl Unpin for SearchQuery
impl UnwindSafe for SearchQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more