pub trait State: MaybeSync {
type Db: Db;
type SchemaCache<'a>: Deref<Target = SchemaCache> + MaybeSend + MaybeSync
where Self: 'a;
// Required methods
fn db(&self) -> &Self::Db;
fn schema_cache(
&self,
) -> impl Future<Output = Self::SchemaCache<'_>> + MaybeSend;
fn config(&self) -> &AppConfig;
fn jwt_config(&self) -> &JwtConfig;
fn jwt_cache(&self) -> Option<&JwtCache>;
// Provided methods
fn default_schema(&self) -> &str { ... }
fn schemas(&self) -> &[String] { ... }
}Expand description
Everything the pipeline needs from its host.
The server’s AppState is one, over a sqlx pool. A host with no sqlx – a
Cloudflare Worker – brings its own, over its own Db. The pipeline is
generic over this, so nothing on the native path goes through a vtable.
Required Associated Types§
Sourcetype SchemaCache<'a>: Deref<Target = SchemaCache> + MaybeSend + MaybeSync
where
Self: 'a
type SchemaCache<'a>: Deref<Target = SchemaCache> + MaybeSend + MaybeSync where Self: 'a
A borrow of the schema cache, held for as long as a request needs it.
Required Methods§
Sourcefn schema_cache(
&self,
) -> impl Future<Output = Self::SchemaCache<'_>> + MaybeSend
fn schema_cache( &self, ) -> impl Future<Output = Self::SchemaCache<'_>> + MaybeSend
The schema cache.
Sourcefn jwt_config(&self) -> &JwtConfig
fn jwt_config(&self) -> &JwtConfig
How tokens are verified.
Provided Methods§
Sourcefn default_schema(&self) -> &str
fn default_schema(&self) -> &str
The schema a request names when it names none.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".