pub struct CleverbotBuilder { /* private fields */ }Expand description
A builder for creating a Cleverbot client.
§Examples
Basic usage:
let cleverbot = CleverbotBuilder::default().build().await?;Custom usage:
let client = reqwest::Client::new();
let cleverbot = CleverbotBuilder::default()
.with_client(client)
.with_custom_history_size(100)
.with_retries(false)
.build()
.await?;Implementations§
Source§impl CleverbotBuilder
impl CleverbotBuilder
Sourcepub fn with_client(self, client: Client) -> Self
pub fn with_client(self, client: Client) -> Self
Set a custom reqwest client.
Sourcepub fn with_retries(self, with_retries: bool) -> Self
pub fn with_retries(self, with_retries: bool) -> Self
Enable or disable retries.
By default, with_retries is set to true.
Sourcepub fn with_custom_history_size(self, history_size: usize) -> Self
pub fn with_custom_history_size(self, history_size: usize) -> Self
Set a custom history size.
By default it’s set to 50.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CleverbotBuilder
impl !RefUnwindSafe for CleverbotBuilder
impl Send for CleverbotBuilder
impl Sync for CleverbotBuilder
impl Unpin for CleverbotBuilder
impl !UnwindSafe for CleverbotBuilder
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