Struct SearchResponse

Source
pub struct SearchResponse {
    pub search_metadata: Option<SearchMetadata>,
    pub organic: Option<Vec<OrganicResult>>,
    pub answer_box: Option<AnswerBox>,
    pub knowledge_graph: Option<KnowledgeGraph>,
    pub related_questions: Option<Vec<RelatedQuestion>>,
    pub shopping: Option<Vec<ShoppingResult>>,
    pub news: Option<Vec<NewsResult>>,
}
Expand description

Complete search response from the Serper API

This struct represents the full response structure that can be returned by the Serper search API, with all possible fields as optional.

Fields§

§search_metadata: Option<SearchMetadata>

Metadata about the search request and response

§organic: Option<Vec<OrganicResult>>

Organic search results

§answer_box: Option<AnswerBox>

Answer box information (direct answers)

§knowledge_graph: Option<KnowledgeGraph>

Knowledge graph information

§related_questions: Option<Vec<RelatedQuestion>>

Related questions/searches

§shopping: Option<Vec<ShoppingResult>>

Shopping results (if applicable)

§news: Option<Vec<NewsResult>>

News results (if applicable)

Implementations§

Source§

impl SearchResponse

Source

pub fn new() -> Self

Creates a new empty search response

Source

pub fn has_results(&self) -> bool

Checks if the response has any results

Source

pub fn organic_count(&self) -> usize

Gets the number of organic results

Source

pub fn organic_results(&self) -> &[OrganicResult]

Gets organic results as a slice

Source

pub fn first_result(&self) -> Option<&OrganicResult>

Gets the first organic result if available

Source

pub fn extract_urls(&self) -> Vec<&str>

Extracts all URLs from organic results

Trait Implementations§

Source§

impl Debug for SearchResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SearchResponse

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SearchResponse

Source§

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 SearchResponse

Source§

fn eq(&self, other: &SearchResponse) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SearchResponse

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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, 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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