#[non_exhaustive]pub struct GatewaySearch { /* private fields */ }Expand description
The [SearchProvider] a Host supplies to search the web through the
Gateway.
It sends every search to one Gateway API root with the Gateway’s shared
bearer key. Each search is one POST {api_root}/tools/web_search
request under a 30-second deadline. The deadline covers the whole
exchange, including reading the reply body. The search vendor’s
credential stays in the Gateway. This provider sends only the Gateway’s
key.
Implementations§
Source§impl GatewaySearch
impl GatewaySearch
Sourcepub fn new(endpoint: GatewayEndpoint, key: SecretString) -> GatewaySearch
pub fn new(endpoint: GatewayEndpoint, key: SecretString) -> GatewaySearch
Builds a search provider from a validated GatewayEndpoint and a
redacted SecretString bearer key.
Trait Implementations§
Source§impl Clone for GatewaySearch
impl Clone for GatewaySearch
Source§fn clone(&self) -> GatewaySearch
fn clone(&self) -> GatewaySearch
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GatewaySearch
impl Debug for GatewaySearch
Source§impl SearchProvider for GatewaySearch
impl SearchProvider for GatewaySearch
Source§fn search<'life0, 'async_trait>(
&'life0 self,
query: SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
query: SearchQuery,
) -> Pin<Box<dyn Future<Output = Result<SearchResults, SearchError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs query as one Gateway web search and returns the Gateway’s
results with every field copied as the Gateway sent it.
§Errors
Returns a [SearchError] with the message of the
GatewaySearchError it keeps as its source. Its kind is:
Transportwhen sending the request fails (request failed) or reading a successful reply fails (reading response failed), including when the deadline passes;Backendwhen the Gateway answers a failure status (backend returned {code}: {body}, orbackend returned {code}, and its error body could not be read), or a success body that is over 256 KiB (response body exceeded {limit} bytes), is invalid UTF-8 (response body was not valid UTF-8), or fails to parse as a search reply (malformed search response).
Auto Trait Implementations§
impl !RefUnwindSafe for GatewaySearch
impl !UnwindSafe for GatewaySearch
impl Freeze for GatewaySearch
impl Send for GatewaySearch
impl Sync for GatewaySearch
impl Unpin for GatewaySearch
impl UnsafeUnpin for GatewaySearch
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more