search::selector

Struct SearchEngineSelector

Source
pub struct SearchEngineSelector(/* private fields */);
Expand description

SearchEngineSelector parses the JSON configuration for search engines and returns the applicable engines depending on their region + locale.

Implementations§

Source§

impl SearchEngineSelector

Source

pub fn new() -> Self

Source

pub fn use_remote_settings_server( self: Arc<Self>, service: &Arc<RemoteSettingsService>, apply_engine_overrides: bool, ) -> SearchApiResult<()>

Sets the RemoteSettingsService to use. The selector will create the relevant remote settings client(s) from the service.

§Params:
  • service: The remote settings service instance for the application.
  • options: The remote settings options to be passed to the client(s).
  • apply_engine_overrides: Whether or not to apply overrides from search-config-v2-overrides to the selected engines. Should be false unless the application supports the click URL feature.
Source

pub fn set_search_config( self: Arc<Self>, configuration: String, ) -> SearchApiResult<()>

Sets the search configuration from the given string. If the configuration string is unchanged since the last update, the cached configuration is reused to avoid unnecessary reprocessing. This helps optimize performance, particularly during test runs where the same configuration may be used repeatedly.

Source

pub fn set_config_overrides( self: Arc<Self>, overrides: String, ) -> SearchApiResult<()>

Source

pub fn clear_search_config(self: Arc<Self>)

Clears the search configuration from memory if it is known that it is not required for a time, e.g. if the configuration will only be re-filtered after an app/environment update.

Source

pub fn filter_engine_configuration( self: Arc<Self>, user_environment: SearchUserEnvironment, ) -> SearchApiResult<RefinedSearchConfig>

Filters the search configuration with the user’s given environment, and returns the set of engines and parameters that should be presented to the user.

Trait Implementations§

Source§

impl Default for SearchEngineSelector

Source§

fn default() -> SearchEngineSelector

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

impl<UT> LiftRef<UT> for SearchEngineSelector

Source§

impl<UT> LowerError<UT> for SearchEngineSelector

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for SearchEngineSelector

Source§

type ReturnType = <Arc<SearchEngineSelector> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for SearchEngineSelector

Source§

const TYPE_ID_META: MetadataBuffer = _

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, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. 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> Same for T

Source§

type Output = T

Should always be Self
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> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T