pub struct AppState {
pub config: ArcSwap<AppConfig>,
pub service: ArcSwap<Service>,
pub tls_manager: Option<TlsManager>,
pub shutdown: GracefulShutdown,
pub config_path: Option<String>,
pub metrics: Arc<Metrics>,
pub modules: Arc<ModuleRegistry>,
}Expand description
Shared application state, hot-swappable via ArcSwap.
Fields§
§config: ArcSwap<AppConfig>§service: ArcSwap<Service>§tls_manager: Option<TlsManager>§shutdown: GracefulShutdown§config_path: Option<String>Optional path to the config file, used for hot-reload from the admin API.
metrics: Arc<Metrics>Shared metrics store.
modules: Arc<ModuleRegistry>Module registry for plugin-provided middleware and handlers.
Implementations§
Source§impl AppState
impl AppState
pub fn new(config: AppConfig, tls_manager: Option<TlsManager>) -> Arc<Self>
Sourcepub fn with_config_path(
config: AppConfig,
tls_manager: Option<TlsManager>,
path: String,
) -> Arc<Self>
pub fn with_config_path( config: AppConfig, tls_manager: Option<TlsManager>, path: String, ) -> Arc<Self>
Create a new AppState with a config file path for hot-reload support.
Sourcepub fn with_modules(
config: AppConfig,
tls_manager: Option<TlsManager>,
modules: ModuleRegistry,
) -> Arc<Self>
pub fn with_modules( config: AppConfig, tls_manager: Option<TlsManager>, modules: ModuleRegistry, ) -> Arc<Self>
Create a new AppState with a pre-populated module registry.
Auto Trait Implementations§
impl !Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe for AppState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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