pub struct HalClient { /* private fields */ }Expand description
An asynchronous client for the HAL search API.
The client is cheap to clone and holds a reusable reqwest client. It works
on native targets and on wasm32 (where it uses the browser fetch API).
use hal_sdk::HalClient;
let client = HalClient::new();
let results = client.basic_search("rust").await?;
println!("{} results", results.num_found());Implementations§
Source§impl HalClient
impl HalClient
Sourcepub fn with_base_url(base_url: impl Into<String>) -> Self
pub fn with_base_url(base_url: impl Into<String>) -> Self
Create a client pointing at a custom base URL (useful for tests or mirrors).
Sourcepub async fn basic_search(
&self,
query: &str,
) -> Result<SearchResponse, HalError>
pub async fn basic_search( &self, query: &str, ) -> Result<SearchResponse, HalError>
Run a basic search over all fields, matching the original chapter-16 behaviour.
Sourcepub async fn search(
&self,
query: &SearchQuery,
) -> Result<SearchResponse, HalError>
pub async fn search( &self, query: &SearchQuery, ) -> Result<SearchResponse, HalError>
Run an arbitrary SearchQuery.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HalClient
impl !UnwindSafe for HalClient
impl Freeze for HalClient
impl Send for HalClient
impl Sync for HalClient
impl Unpin for HalClient
impl UnsafeUnpin for HalClient
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