pub struct ConfigBuilder { /* private fields */ }Expand description
🏗️ 配置构建器 - 提供流畅的API
§示例
use openlark_client::Config;
use std::time::Duration;
let config = Config::builder()
.app_id("your_app_id")
.app_secret("your_app_secret")
.base_url("https://open.feishu.cn")
.timeout(Duration::from_secs(60))
.retry_count(5)
.enable_log(true)
.add_header("X-Custom-Header", "value")
.build();Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn app_secret<S: Into<String>>(self, app_secret: S) -> Self
pub fn app_secret<S: Into<String>>(self, app_secret: S) -> Self
🔑 设置应用密钥
Sourcepub fn enable_token_cache(self, enable: bool) -> Self
pub fn enable_token_cache(self, enable: bool) -> Self
🔐 设置是否允许自动获取 token(默认 true)
Sourcepub fn retry_count(self, count: u32) -> Self
pub fn retry_count(self, count: u32) -> Self
🔄 设置重试次数
Sourcepub fn enable_log(self, enable: bool) -> Self
pub fn enable_log(self, enable: bool) -> Self
📝 设置是否启用日志
Sourcepub fn add_header<K, V>(self, key: K, value: V) -> Self
pub fn add_header<K, V>(self, key: K, value: V) -> Self
🔧 添加自定义HTTP header
Sourcepub fn build_unvalidated(self) -> Config
pub fn build_unvalidated(self) -> Config
🔨 构建配置实例(跳过验证)
注意:使用此方法时配置可能无效,后续使用时需要验证
Trait Implementations§
Source§impl Clone for ConfigBuilder
impl Clone for ConfigBuilder
Source§fn clone(&self) -> ConfigBuilder
fn clone(&self) -> ConfigBuilder
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 ConfigBuilder
impl Debug for ConfigBuilder
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl !RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnsafeUnpin for ConfigBuilder
impl !UnwindSafe for ConfigBuilder
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