pub struct SimpleTranslationConfig {
pub enabled: bool,
pub target_lang: String,
pub source_lang: String,
pub api_url: String,
pub requests_per_second: f64,
pub max_text_length: usize,
pub cache_enabled: bool,
pub cache_ttl_seconds: u64,
}Expand description
简化的翻译配置
Fields§
§enabled: bool是否启用翻译
target_lang: String目标语言
source_lang: String源语言(默认“auto“自动检测)
api_url: StringAPI地址
requests_per_second: f64请求频率限制(每秒)
max_text_length: usize最大文本长度
cache_enabled: bool是否启用缓存
cache_ttl_seconds: u64缓存TTL(秒)
Implementations§
Source§impl SimpleTranslationConfig
impl SimpleTranslationConfig
Sourcepub fn builder() -> ConfigBuilder
pub fn builder() -> ConfigBuilder
创建配置构建器
Sourcepub fn request_interval(&self) -> Duration
pub fn request_interval(&self) -> Duration
获取请求间隔时间
Trait Implementations§
Source§impl Clone for SimpleTranslationConfig
impl Clone for SimpleTranslationConfig
Source§fn clone(&self) -> SimpleTranslationConfig
fn clone(&self) -> SimpleTranslationConfig
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 SimpleTranslationConfig
impl Debug for SimpleTranslationConfig
Source§impl Default for SimpleTranslationConfig
impl Default for SimpleTranslationConfig
Source§impl<'de> Deserialize<'de> for SimpleTranslationConfig
impl<'de> Deserialize<'de> for SimpleTranslationConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SimpleTranslationConfig
impl PartialEq for SimpleTranslationConfig
Source§impl Serialize for SimpleTranslationConfig
impl Serialize for SimpleTranslationConfig
impl StructuralPartialEq for SimpleTranslationConfig
Auto Trait Implementations§
impl Freeze for SimpleTranslationConfig
impl RefUnwindSafe for SimpleTranslationConfig
impl Send for SimpleTranslationConfig
impl Sync for SimpleTranslationConfig
impl Unpin for SimpleTranslationConfig
impl UnwindSafe for SimpleTranslationConfig
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