pub struct ClientBuilder { /* private fields */ }Expand description
Builder for creating a customized AnkiClient.
§Example
use std::time::Duration;
use ankit::AnkiClient;
let client = AnkiClient::builder()
.url("http://localhost:8765")
.api_key("my-secret-key")
.timeout(Duration::from_secs(60))
.build();Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn new() -> ClientBuilder
pub fn new() -> ClientBuilder
Create a new builder with default settings.
Sourcepub fn url(self, url: impl Into<String>) -> ClientBuilder
pub fn url(self, url: impl Into<String>) -> ClientBuilder
Set the AnkiConnect URL.
Defaults to http://127.0.0.1:8765.
Sourcepub fn api_key(self, key: impl Into<String>) -> ClientBuilder
pub fn api_key(self, key: impl Into<String>) -> ClientBuilder
Set the API key for authentication.
Only required if AnkiConnect is configured to require an API key.
Sourcepub fn timeout(self, duration: Duration) -> ClientBuilder
pub fn timeout(self, duration: Duration) -> ClientBuilder
Set the request timeout.
Defaults to 30 seconds.
Sourcepub fn build(self) -> AnkiClient
pub fn build(self) -> AnkiClient
Build the client.
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Source§impl Default for ClientBuilder
impl Default for ClientBuilder
Source§fn default() -> ClientBuilder
fn default() -> ClientBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
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