pub struct AppConfig {
pub server: ServerConfig,
pub cache: CacheConfig,
pub oauth: OAuthConfig,
pub logging: LoggingConfig,
pub performance: PerformanceConfig,
}Expand description
应用程序配置
包含服务器、缓存、OAuth、日志和性能配置。
§字段
server: 服务器配置cache: 缓存配置oauth: OAuth 配置logging: 日志配置performance: 性能配置
Fields§
§server: ServerConfig服务器配置
cache: CacheConfig缓存配置
oauth: OAuthConfigOAuth 配置
logging: LoggingConfig日志配置
performance: PerformanceConfig性能配置
Implementations§
Source§impl AppConfig
impl AppConfig
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Load configuration from file
§Errors
Returns an error if file does not exist, cannot be read, or format is invalid
Sourcepub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
Save configuration to file
§Errors
Returns an error if configuration cannot be serialized, directory cannot be created, or file cannot be written
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Validate configuration
§Errors
Returns an error if configuration is invalid (e.g., empty hostname, invalid port, etc.)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AppConfig
impl<'de> Deserialize<'de> for AppConfig
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 AppConfig
impl RefUnwindSafe for AppConfig
impl Send for AppConfig
impl Sync for AppConfig
impl Unpin for AppConfig
impl UnsafeUnpin for AppConfig
impl UnwindSafe for AppConfig
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