pub struct AppState {
pub config: Arc<Config>,
pub db: SqlitePool,
pub http: Client,
pub identity: Arc<IdentityResolver>,
}Expand description
Shared application state passed to every Axum handler.
This is the central state object that every route handler receives via
axum::extract::State<AppState>. It holds the parsed configuration,
database connection pool, and a shared HTTP client for outbound requests.
AppState is cheaply cloneable — all inner fields are either Arc-wrapped
or already use internal reference counting (e.g. SqlitePool, reqwest::Client).
Fields§
§config: Arc<Config>Parsed configuration from atrg.toml.
db: SqlitePoolSQLite connection pool.
http: ClientShared HTTP client for outbound requests.
identity: Arc<IdentityResolver>DID/handle resolver with TTL-backed in-memory cache.
Trait Implementations§
Source§impl FromRef<AppState> for Arc<IdentityResolver>
impl FromRef<AppState> for Arc<IdentityResolver>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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