systemprompt_agent/
state.rs1use std::sync::Arc;
7use systemprompt_database::DbPool;
8use systemprompt_models::Config;
9use systemprompt_traits::DynJwtValidationProvider;
10
11#[derive(Clone)]
12pub struct AgentState {
13 db_pool: DbPool,
14 config: Arc<Config>,
15 jwt_provider: DynJwtValidationProvider,
16}
17
18impl AgentState {
19 #[must_use]
20 pub fn new(
21 db_pool: DbPool,
22 config: Arc<Config>,
23 jwt_provider: DynJwtValidationProvider,
24 ) -> Self {
25 Self {
26 db_pool,
27 config,
28 jwt_provider,
29 }
30 }
31
32 #[must_use]
33 pub const fn db_pool(&self) -> &DbPool {
34 &self.db_pool
35 }
36
37 #[must_use]
38 pub fn config(&self) -> &Config {
39 &self.config
40 }
41
42 #[must_use]
43 pub fn jwt_provider(&self) -> &DynJwtValidationProvider {
44 &self.jwt_provider
45 }
46}
47
48impl std::fmt::Debug for AgentState {
49 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
50 f.debug_struct("AgentState")
51 .field("db_pool", &"<DbPool>")
52 .field("config", &"<Arc<Config>>")
53 .field("jwt_provider", &"<DynJwtValidationProvider>")
54 .finish()
55 }
56}