pub struct TranslationLibConfig {
pub translation: TranslationConfig,
}Expand description
翻译库配置结构
包含所有翻译相关的配置选项,支持从TOML文件加载和保存。
§示例
use markdown_translator::TranslationLibConfig;
// 从默认位置加载配置
let config = TranslationLibConfig::load_from_default_locations();
// 从指定文件加载配置
let config = TranslationLibConfig::from_file("config.toml").unwrap();
// 保存配置到文件
config.save_to_file("output.toml").unwrap();Fields§
§translation: TranslationConfig翻译配置
Implementations§
Source§impl TranslationLibConfig
impl TranslationLibConfig
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Box<dyn Error>>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Box<dyn Error>>
Load configuration from TOML file
Sourcepub fn save_to_file<P: AsRef<Path>>(
&self,
path: P,
) -> Result<(), Box<dyn Error>>
pub fn save_to_file<P: AsRef<Path>>( &self, path: P, ) -> Result<(), Box<dyn Error>>
Save configuration to TOML file
Sourcepub fn load_from_default_locations() -> Self
pub fn load_from_default_locations() -> Self
Load configuration from multiple possible locations
Trait Implementations§
Source§impl Clone for TranslationLibConfig
impl Clone for TranslationLibConfig
Source§fn clone(&self) -> TranslationLibConfig
fn clone(&self) -> TranslationLibConfig
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 TranslationLibConfig
impl Debug for TranslationLibConfig
Source§impl Default for TranslationLibConfig
impl Default for TranslationLibConfig
Source§impl<'de> Deserialize<'de> for TranslationLibConfig
impl<'de> Deserialize<'de> for TranslationLibConfig
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
Auto Trait Implementations§
impl Freeze for TranslationLibConfig
impl RefUnwindSafe for TranslationLibConfig
impl Send for TranslationLibConfig
impl Sync for TranslationLibConfig
impl Unpin for TranslationLibConfig
impl UnwindSafe for TranslationLibConfig
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