pub struct ConfigBuilder { /* private fields */ }Expand description
配置构建器,提供链式API
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
pub fn new() -> Self
Sourcepub fn target_lang<S: Into<String>>(self, lang: S) -> Self
pub fn target_lang<S: Into<String>>(self, lang: S) -> Self
设置目标语言
Sourcepub fn source_lang<S: Into<String>>(self, lang: S) -> Self
pub fn source_lang<S: Into<String>>(self, lang: S) -> Self
设置源语言
Sourcepub fn requests_per_second(self, rate: f64) -> Self
pub fn requests_per_second(self, rate: f64) -> Self
设置请求频率
Sourcepub fn max_text_length(self, length: usize) -> Self
pub fn max_text_length(self, length: usize) -> Self
设置最大文本长度
Sourcepub fn cache_enabled(self, enabled: bool) -> Self
pub fn cache_enabled(self, enabled: bool) -> Self
设置缓存启用状态
Sourcepub fn cache_ttl_seconds(self, seconds: u64) -> Self
pub fn cache_ttl_seconds(self, seconds: u64) -> Self
设置缓存TTL
Sourcepub fn build(self) -> Result<SimpleTranslationConfig, String>
pub fn build(self) -> Result<SimpleTranslationConfig, String>
构建配置
Sourcepub fn build_unchecked(self) -> SimpleTranslationConfig
pub fn build_unchecked(self) -> SimpleTranslationConfig
构建配置(不验证)
Trait Implementations§
Source§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 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