pub struct ForgeConfig {
pub environment: Environment,
pub runtime: RuntimeConfig,
pub processor: ProcessorConfig,
pub performance: PerformanceConfig,
pub event: EventConfig,
pub history: HistoryConfig,
pub extension: ExtensionConfig,
pub cache: CacheConfig,
}Expand description
统一的 Forge 配置结构
Fields§
§environment: Environment运行环境
runtime: RuntimeConfig运行时配置
processor: ProcessorConfig任务处理器配置
performance: PerformanceConfig性能监控配置
event: EventConfig事件系统配置
history: HistoryConfig历史记录配置
extension: ExtensionConfig扩展系统配置
cache: CacheConfig缓存配置
Implementations§
Source§impl ForgeConfig
impl ForgeConfig
Sourcepub fn for_environment(env: Environment) -> Self
pub fn for_environment(env: Environment) -> Self
为指定环境创建配置
Sourcepub fn development() -> Self
pub fn development() -> Self
开发环境配置
Sourcepub fn production() -> Self
pub fn production() -> Self
生产环境配置
Sourcepub fn builder() -> ForgeConfigBuilder
pub fn builder() -> ForgeConfigBuilder
创建配置构建器
Sourcepub fn validate(&self) -> Result<(), ConfigValidationError>
pub fn validate(&self) -> Result<(), ConfigValidationError>
验证配置的合理性
Sourcepub fn get_tuning_suggestions(&self) -> Vec<String>
pub fn get_tuning_suggestions(&self) -> Vec<String>
获取环境特定的配置调整建议
Source§impl ForgeConfig
配置工具函数
impl ForgeConfig
配置工具函数
Sourcepub fn from_env_override(self) -> Self
pub fn from_env_override(self) -> Self
从环境变量加载配置覆盖
支持的环境变量格式:
- FORGE_ENVIRONMENT: 运行环境
- FORGE_PROCESSOR_MAX_QUEUE_SIZE: 队列大小
- FORGE_PROCESSOR_MAX_CONCURRENT_TASKS: 并发任务数
- FORGE_PERFORMANCE_ENABLE_MONITORING: 启用监控
- 等等…
Sourcepub fn merge_with(self, other: &ForgeConfig) -> Self
pub fn merge_with(self, other: &ForgeConfig) -> Self
合并另一个配置,优先使用 other 的非默认值
Trait Implementations§
Source§impl Clone for ForgeConfig
impl Clone for ForgeConfig
Source§fn clone(&self) -> ForgeConfig
fn clone(&self) -> ForgeConfig
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 ForgeConfig
impl Debug for ForgeConfig
Source§impl Default for ForgeConfig
impl Default for ForgeConfig
Source§fn default() -> ForgeConfig
fn default() -> ForgeConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ForgeConfig
impl<'de> Deserialize<'de> for ForgeConfig
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 ForgeConfig
impl RefUnwindSafe for ForgeConfig
impl Send for ForgeConfig
impl Sync for ForgeConfig
impl Unpin for ForgeConfig
impl UnwindSafe for ForgeConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage