pub struct AppState {
pub db: Arc<Database>,
pub config: RwLock<MultiAppConfig>,
pub proxy_service: ProxyService,
}Expand description
全局应用状态
Fields§
§db: Arc<Database>§config: RwLock<MultiAppConfig>§proxy_service: ProxyServiceImplementations§
Source§impl AppState
impl AppState
Sourcepub fn try_new_with_startup_recovery() -> Result<Self, AppError>
pub fn try_new_with_startup_recovery() -> Result<Self, AppError>
创建新的应用状态,并在真实进程启动路径上执行一次启动恢复。
Sourcepub fn save_preserving_current_providers(
&self,
app_types: &[AppType],
) -> Result<(), AppError>
pub fn save_preserving_current_providers( &self, app_types: &[AppType], ) -> Result<(), AppError>
将内存中的 config 快照持久化到 SQLite,但保留指定应用当前供应商的 DB 选择。
Sourcepub fn refresh_config_from_db(&self) -> Result<(), AppError>
pub fn refresh_config_from_db(&self) -> Result<(), AppError>
用数据库中的最新快照重建内存配置,供导入/恢复后的 live 同步流程复用。
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<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> 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 more