pub struct EngineDescriptor {
pub id: &'static str,
pub label: &'static str,
pub category: &'static str,
pub kind: EngineKind,
pub cors_readable: bool,
pub default_for_category: bool,
pub method: HttpMethod,
pub build_url: fn(&str, &SearchOptions) -> String,
pub build_body: Option<fn(&str, &SearchOptions) -> String>,
pub headers: Option<fn(&SearchOptions) -> Vec<(String, String)>>,
pub parse: fn(&str, usize, &SearchOptions) -> Vec<SearchResult>,
}Expand description
A declarative description of a single search engine.
Fields§
§id: &'static strStable provider id.
label: &'static strHuman-readable label.
category: &'static strProvider category (one of super::registry::CATEGORIES).
kind: EngineKindHow the response body is decoded.
cors_readable: boolWhether the endpoint is browser-CORS readable.
default_for_category: boolWhether this is its category’s default provider.
method: HttpMethodHTTP method.
build_url: fn(&str, &SearchOptions) -> StringBuild the request URL from the query and options.
build_body: Option<fn(&str, &SearchOptions) -> String>Build an optional POST body.
headers: Option<fn(&SearchOptions) -> Vec<(String, String)>>Extra request headers (e.g. auth tokens).
parse: fn(&str, usize, &SearchOptions) -> Vec<SearchResult>Parse the decoded body into results.
Trait Implementations§
Source§impl Clone for EngineDescriptor
impl Clone for EngineDescriptor
Source§fn clone(&self) -> EngineDescriptor
fn clone(&self) -> EngineDescriptor
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 moreimpl Copy for EngineDescriptor
Auto Trait Implementations§
impl Freeze for EngineDescriptor
impl RefUnwindSafe for EngineDescriptor
impl Send for EngineDescriptor
impl Sync for EngineDescriptor
impl Unpin for EngineDescriptor
impl UnsafeUnpin for EngineDescriptor
impl UnwindSafe for EngineDescriptor
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