pub struct OpenLibraryClientBuilder { /* private fields */ }Expand description
Builder for OpenLibraryClient.
Implementations§
Source§impl OpenLibraryClientBuilder
impl OpenLibraryClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Override the base URL (useful for testing with a local mock server).
Sourcepub fn covers_url(self, url: impl Into<String>) -> Self
pub fn covers_url(self, url: impl Into<String>) -> Self
Override the covers base URL.
Sourcepub fn connect_timeout(self, d: Duration) -> Self
pub fn connect_timeout(self, d: Duration) -> Self
TCP connection timeout (default 10 s).
Sourcepub fn rate_limit(self, rps: u32) -> Self
pub fn rate_limit(self, rps: u32) -> Self
Requests per second for the built-in rate limiter (default 1 req/s).
Set to 3 when you also call contact_email to unlock the identified-tier limit.
Sourcepub fn contact_email(self, email: impl Into<String>) -> Result<Self>
pub fn contact_email(self, email: impl Into<String>) -> Result<Self>
Provide a contact email address. This is appended to the User-Agent header so the
Open Library API can identify your application and grant the 3 req/s tier.
Call rate_limit(3) together with this to actually use that tier.
Sourcepub fn build(self) -> Result<OpenLibraryClient>
pub fn build(self) -> Result<OpenLibraryClient>
Build the OpenLibraryClient.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OpenLibraryClientBuilder
impl RefUnwindSafe for OpenLibraryClientBuilder
impl Send for OpenLibraryClientBuilder
impl Sync for OpenLibraryClientBuilder
impl Unpin for OpenLibraryClientBuilder
impl UnsafeUnpin for OpenLibraryClientBuilder
impl UnwindSafe for OpenLibraryClientBuilder
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