pub struct PubChemClientBuilder { /* private fields */ }Expand description
Builder for PubChemClient.
Implementations§
Source§impl PubChemClientBuilder
impl PubChemClientBuilder
Sourcepub fn requests_per_second(self, n: u32) -> Self
pub fn requests_per_second(self, n: u32) -> Self
Maximum HTTP requests per second (default: 5 — PubChem’s published limit).
Sourcepub fn cache_capacity(self, n: u64) -> Self
pub fn cache_capacity(self, n: u64) -> Self
In-memory cache capacity in number of entries (default: 1 000).
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Override the PubChem base URL (useful for testing against a local mock server).
Sourcepub fn build(self) -> PubChemClient
pub fn build(self) -> PubChemClient
Build the PubChemClient.
§Panics
Panics if the TLS backend cannot be initialised (extremely rare;
indicates a broken system environment). For an infallible path in
constrained environments use try_build.
Sourcepub fn try_build(self) -> Result<PubChemClient>
pub fn try_build(self) -> Result<PubChemClient>
Build the PubChemClient, returning an error instead of panicking if
the underlying HTTP client cannot be initialised (e.g. TLS failure).
Prefer this over build in long-running servers and WASM
environments where a panic is unacceptable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PubChemClientBuilder
impl RefUnwindSafe for PubChemClientBuilder
impl Send for PubChemClientBuilder
impl Sync for PubChemClientBuilder
impl Unpin for PubChemClientBuilder
impl UnsafeUnpin for PubChemClientBuilder
impl UnwindSafe for PubChemClientBuilder
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